• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sockets and ip

 
Raken Silberchatz
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as i know sockets are initiated using hostname so i want to know how can i initiate a socket using ip address only and if it can be done like that how can i use ip and sockets to make a connection to other computers
 
Catalin Merfu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To create an address based on an IP string:

InetAddress address = InetAddress.getByName( "216.138.2.43" );

Check out this tutorial:
http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!