hi hi..
how can i convert an IP address to an IP number?
Example from IP address :192.168.0.1 to <ip no>
???
ocw
Printable View
hi hi..
how can i convert an IP address to an IP number?
Example from IP address :192.168.0.1 to <ip no>
???
ocw
-cast each byte into a char
-create a string
-remove the dots '.'
-parse long
and there is your IP number "I've never heard about this idea" :)
String s = ip_address;
StringTokenizer st = new StringTokenizer(s,'.');
//lloop and create a new string
You only get IP addresses as Array of bytes so I think my way is betterQuote:
Originally Posted by System_Error
Probably. Just now remembered they were byte arrays when you said that.