Neil
Neil

Reputation: 55

How to get the local IP of the client in Netty Framework?

I want to get the remoteAddress of the client from itself. I can already connect successfully to the server using:

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

I am using SimpleChannelInboundHandler for the sake of simplicity.

Upvotes: 1

Views: 2000

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

In the handler you would do ctx.channel().remoteAddress(). When using connect you can use f.channel().remoteAddress()

Upvotes: 1

Related Questions