Commit 6889e078 authored by duanruiming's avatar duanruiming

[update] 测试端口

parent bdba4d50
...@@ -42,6 +42,7 @@ public class NettyClient { ...@@ -42,6 +42,7 @@ public class NettyClient {
.channel(NioDatagramChannel.class) .channel(NioDatagramChannel.class)
.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(65535)) .option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(65535))
.localAddress(5051) .localAddress(5051)
.remoteAddress(new InetSocketAddress("10.102.1.204", 5050))
.handler(new ChannelInitializer<NioDatagramChannel>() { .handler(new ChannelInitializer<NioDatagramChannel>() {
@Override @Override
protected void initChannel(NioDatagramChannel datagramChannel) { protected void initChannel(NioDatagramChannel datagramChannel) {
...@@ -49,7 +50,7 @@ public class NettyClient { ...@@ -49,7 +50,7 @@ public class NettyClient {
.addLast(new NettyServerHandler(threadPoolExecutor)); .addLast(new NettyServerHandler(threadPoolExecutor));
} }
}); });
ChannelFuture channelFuture = bootstrap.bind(port).sync(); ChannelFuture channelFuture = bootstrap.bind().sync();
Runtime.getRuntime().addShutdownHook(new Thread(() -> { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
group.shutdownGracefully(); group.shutdownGracefully();
channelFuture.channel().closeFuture().syncUninterruptibly(); channelFuture.channel().closeFuture().syncUninterruptibly();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment