Multiple port server with Netty 4?

I want to bind two server socket (eg. port 8000, 8001) within one Netty application.

I tried to merge DiscardServer and EchoServer example to test.

But in the first server initialization code,

ChannelFuture f = bootstrap1.bind(port).sync();
f.channel().closeFuture().sync(); // <-- program blocks here

The program execution blocks so the second server initialization code can't reach.

How can I start two different port servers with Netty 4.0?


只是评论这个条款

f.channel().closeFuture().sync(); // <-- program blocks here

I found a answer about listen multi-port service

Please Reading : Netty 4.0 on multiple ports with multiple protocols?

链接地址: http://www.djcxy.com/p/64774.html

上一篇: Netty中绑定和连接的socketchannelState之间的区别

下一篇: 带Netty 4的多端口服务器?