• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting InetAddress over UDP protocol

 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to connect to a server over UDP.
how can I get the "raw IP Address" as they call it in the documentation starting from the normal ip "10.10.12.123" ??

this raw IP address as a byte[] is the agrument passed to the constructor of an InetAddress class.

Thanks a lot for your help.
regards,
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use InetAddress.getByName():
Determines the IP address of a host, given the host's name.

The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.

java.net.InetAddress
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!