netty绑定端口报错bug解决

This commit is contained in:
guoshengxiong 2025-04-07 17:05:32 +08:00
parent 37539074a4
commit cb45d95486

View File

@ -53,6 +53,7 @@ public class NettyTcpServer {
*/
@PostConstruct
public void start() throws InterruptedException {
try {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
@ -65,6 +66,9 @@ public class NettyTcpServer {
if (channelFuture.isSuccess()) {
log.info("定位TCP服务启动完毕,port={}", this.port);
}
} catch (Exception e) {
log.error("定位TCP服务启动异常,port={}", this.port);
}
}
/**