This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes using IP address in Socket Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "using IP address in Socket" Watch "using IP address in Socket" New topic
Author

using IP address in Socket

Rodge Thomas
Ranch Hand

Joined: Jul 25, 2002
Posts: 38
Hi,
I have a simple chat application using JSSE. I will demonstrate it in class at school. How can I use an Ip address, rather than a host name ?
thank you,
rodge


SCJP, SCWCD
Jon Dornback
Ranch Hand

Joined: Apr 24, 2002
Posts: 137
what exactly do you mean? if you are talking about using an ip instead of a hostname for the Socket constructor, then just use a String of the ip instead of the host.
eg:
Socket s = new Socket("127.0.0.1",4545);
//works the same as:
Socket s = new Socket("localhost",4545);
is that what you're asking?


use the [CODE] tags - it makes it much easier for people to help you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using IP address in Socket
 
Similar Threads
InetAddress
how to get IP address in linux
Returning the users IP address
InetAddress
RMI lookup