To print the IP address of a client use
System.out.println(clientSocket.getInetAddress().toString());
It will print the Ip address in this format /XXX.XXX.X.XX
>>How can i interpret this?
It depends on what you want to do with the IP address or hostname.
jasimp
Senior Poster
3,623 posts since Aug 2007
Reputation Points: 533
Solved Threads: 53
If I will run my Server program, the output will be 0:0:0:0:0:0:0:1.
Is that an IPv6 address?
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
same with me too.Got local host only.
Dhaneshnm
Junior Poster in Training
52 posts since Mar 2009
Reputation Points: 22
Solved Threads: 7
how can i determine that i am using a ipv6 address? and what version should be used?
IPv6 addresses look like 1080:0:0:0:8:800:200C:417A
IPv4 addresses look like 192.169.0.1
IPv4 is the current version, and universally available, but it's fast running out of addresses. IPv6 is the solution for the future, but it's rolling out very slowly, and not supported by many servers yet.
You should use whatever your network admin says. If you get your IP address automatically via DHCP you don't need to worry.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
Sorry man, that is as much as I know about IPv6! You'll need to find someone who knows more about it. When you do, please post what you find back here, so we can all learn. Good luck.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073