我正在使用 Netty 编写 Java 游戏服务器。我可以从 localhost 成功连接客户端,但不能从远程 PC 连接。netstat
util中不显示监听套接字。我在我的conf中遗漏了什么吗?
@Override
public void startServer(String host, int port) {
// Initialize server bootstrap
if (bootstrap == null) {
bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
bootstrap.setPipelineFactory(channelPipelineFactory);
bootstrap.setOption("keepAlive", true);
bootstrap.setOption("tcpNoDelay", true);
}
// Unbind the port if bound
if (serverChannel != null && serverChannel.isBound()) {
serverChannel.unbind();
}
serverChannel = bootstrap.bind(hostAddress);
...
}