This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Getiing Server IP address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Getiing Server IP address" Watch "Getiing Server IP address" New topic
Author

Getiing Server IP address

Deepa Jayaprakash
Greenhorn

Joined: Sep 12, 2005
Posts: 14
Hello,
How can i get server IP using java code?

Thanks
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Need more info, does the server need it's own IP, or does a client need the server's IP?
Deepa Jayaprakash
Greenhorn

Joined: Sep 12, 2005
Posts: 14
Its client which wants server IP.
Jody Brown
Ranch Hand

Joined: Nov 09, 2005
Posts: 43
Could you use java.net.InetAddress.getAddress() to obtain it?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18113
    
    8

Does the client already have a connection to the server? If it's a Socket connection then you'd just use the getInetAddress() method of the Socket class.

But if the question is "I have no idea what the IP address of the server is, how can I connect to it?" then the answer is something like "Ask the administrator of the server."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getiing Server IP address
 
Similar Threads
Can't connect to SQL server 2005
public JDBC
how to connect to my web application from another computer
trying to connect to another ip adress
Need to configure DataSource