I am trying to get hostname of my windows server using below code:
Socket.getLocalAddress().getCanonicalHostName();
It's returning the loopback address. in Java help for getLocalAddress()
it is mentioned as
"If there is a security manager set, its checkConnect method is called with the local address and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, the loopback address is returned"
Could anyone tell what is this security manager exactly? how I will get the Exact IP address instead of loopback address?