title: Netty: getting remote ip address in messageReceived
body: <p>In my class (extends SimpleChannelHandler) I'm trying to get the ip where the message was originally sent from. </p>
  
  <pre><code>@Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent ev) throws Exception {
      String host = ((InetSocketAddress)ctx.getChannel().getRemoteAddress()).getAddress().getHostAddress();
      int port = ((InetSocketAddress)ctx.getChannel().getRemoteAddress()).getPort();
      LOG.debug(String.format("host:%s port:%d", host, port));
  
      ..
  </code></pre>
  
  <p>This prints ip 10.0.0.1 (gateway), instead of the correct client address (10.52.45.4).</p>
  
  <p>Is there any way to get the ip i'm trying to or could there be something wrong with the network configuration ?</p>