Netty实战四:netty获取客户端IP
程序员文章站
2022-04-22 21:56:38
...
import io.netty.channel.ChannelHandlerContext;
//ChannelHandlerContext chc
InetSocketAddress ipSocket = (InetSocketAddress)chc.channel().remoteAddress();
String clientIp = ipSocket.getAddress().getHostAddress();
log.info("客户端ip地址:{}",clientIp);
下一篇: 环信即时通讯——集成客户端