Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using IP address in Socket  RSS feed

 
Rodge Thomas
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jon Dornback
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!