I have the following 2 problems when retrieving the ip client.
I created the following code inside the class:
private static InetAddress thisIp;
static{
try {
thisIp = InetAddress.getLocalHost();
System.out.println("MyIp is: " + thisIp);
} catch(UnknownHostException ex) {
}
}
My problems:
1) The previous code should get the IP address of the client, when I run it, it will print the following message:
MyIp: andrea-virtual-machine / 127.0.1.1
Why does it start with andrea-virtual-machine / ? (I am developing in a virtual machine) is this a problem?
2) Thus, I can only get one IP address, but I could have more than one network card, so I could have more than one IP address, but several IP addresses
, ? IP- ArrayList
Andrea