如何在Netty Framework中获取客户端的本地IP?

时间:2015-04-12 16:35:35

标签: netty

我想从客户端获取客户端的 remoteAddress 。我已经可以使用以下方法成功连接到服务器:

b.connect(this.hostAddress.getHostAddress(), this.port).sync(); // b is a Bootstrap object

为简单起见,我使用SimpleChannelInboundHandler

1 个答案:

答案 0 :(得分:-1)

在处理程序中,您将执行ctx.channel().remoteAddress()。使用连接时,您可以使用f.channel().remoteAddress()