I have got the ip address from the HTTP request object using
request.getRmeoteAddr() => 127.0.0.0
However im using netty and when I use
SocketAddress socketAddress = channel.getRemoteAddress();
InetSocketAddress inetAddr = (InetSocketAddress)socketAddress;
ipAddress = inetAddr.getAddress().toString();
=> 0.0.0.0.0.1
This is causing me problems when trying to compare, i want them in the same fomrat…
any ideas?
use getHostAddress(); that should do it.
http://docs.oracle.com/javase/1.4.2/docs/api/java/net/InetAddress.html#getHostAddress()