Hi there,
Does anyone know how to get the Local Net Ip Address from a Remote Client in java?
thx
Hi there,
Does anyone know how to get the Local Net Ip Address from a Remote Client in java?
thx
Is this what you are looking for?
InetAddress addr = InetAddress.getLocalHost();
byte[] ipAddr = addr.getAddress(); // Get IP Address
String hostname = addr.getHostName(); // Get hostname
That gets the IP of the machine the code is running on.
Assuming you mean getting the local IP address of a client running behind NAT, you can only do that with the client's cooperation, meaning you have to send it yourself.
What do you need it for anyway?