InetAddress addr = java.net.InetAddress.getRemoteHost();
MyHost = addr.getHostName();
IPaddressString = addr.getHostAddress();
The above code returns the users local data being 127.0.0.1 and Localhost
InetAddress addr = java.net.InetAddress.getRemoteHost();
MyHost = addr.getHostName();
IPaddressString = addr.getHostAddress();
The above code returns the users local data being 127.0.0.1 and Localhost
1. If you want the IP of the remote user then you must have his Domain Name , if you want his Domain Name then you must have his IP.
2. Now i hope you are in LAN Environment, and have configured the IPs correctly.
3. Try assigning your PC with an ip suppose 192.168.20.1 and the other pc as 192.168.20.2
4. If you have Domain Name Associated with the remote pc, then you will get his Domain Name in return by using your code.