Could use some help,
I working on decoding some data from a UDP server. In the response I get a list of IP addresses and Port numbers as a byte array. I then converted them to hex strings.
I'm confused about the format of some of the IP address once I convert them to decimal. Some of them don't seem to follow the normal IP format of xxx.xx.xxx.xx .
Here is the code:
public void addPeer(String addressin, String portin){ String address = addressin; String port = portin; System.out.println("IP Hex: " + address); System.out.println("Port Hex: " + port); long A = Long.parseLong(address, 16); long B = Long.parseLong(port, 16); System.out.println("IP Decimal: " + A); System.out.println("Port Decimal: " + B); }
...and the Output:
IP Hex: 7e7548f3 Port Hex: 969f IP Decimal: 2121615603 Port Decimal: 38559 IP Hex: 6b4da427 Port Hex: 2a97 IP Decimal: 1800250407 Port Decimal: 10903 IP Hex: d995a68b Port Hex: d564 IP Decimal: 3650463371 Port Decimal: 54628 IP Hex: 0539728e Port Hex: 5b39 IP Decimal: 87650958 Port Decimal: 23353
So the 4th one down as Decimal is "87650958"... I'm confused as to what format this is and IP lookup says its not a valid IP.
I don't how that would fit in the format xxx.xx.xxx.xx
Am I converting them wrong or am I just getting junk values from the server?