Finding an InetAddress
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   matthew_magliocca
Posted On:   Monday, April 8, 2002 07:53 PM

To build my messanger I'm trying to use sockets but I can't seem to figure out how to get The InetAddress of another computer. I can't even get my own since everytime i check it says default. How can I find the InetAddress or something that will let me connect to another computer? They'll be loging on using my software to chat so I have a lot of control over their protocols.

Re: Finding an InetAddress

Posted By:   Martin_Kernland  
Posted On:   Thursday, April 18, 2002 12:22 AM

You're probably in the wrong forum. If you would use JMS to build your chat (it takes
only minutes to set up the communication) then you would not need to use InetAddress
at all. (just send your messages to the topic and the JMS server takes care of the rest.)
However, what you might be looking for is this:


InetAddress addr = InetAddress.getByName("java.sun.com");
System.out.println("ip address is: " + addr.getHostAddress());

-kerny
About | Sitemap | Contact