[英]netty bootstrap connection refused
尝试连接客户端io.netty.bootstrap.Bootstrap
:
ChannelFuture cf = null;
cf = m_bootstrap.connect(new InetSocketAddress(InetAddress
.getByName("127.0.0.1"), 8084));
在cf中, result
: java.net.ConnectException: Connection refused: /127.0.0.1:8084
详细消息:
[sun.nio.ch.SocketChannelImpl.checkConnect(本机方法),sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599),io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java: 208),io.netty.channel.nio.AbstractNioChannel $ AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:287),io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528),io.netty.channel.nio .NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468),io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382),io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354), io.netty.util.concurrent.SingleThreadEventExecutor $ 2.run(SingleThreadEventExecutor.java:116),java.lang.Thread.run(Thread.java:695)]
我的/ etc / hosts文件看起来像这样:
127.0.0.1>--localhost
255.255.255.255>broadcasthost
::1 localhost-
****::1%lo*>localhost
127.0.0.1>--********
不知道该怎么办? 从字面上假设我可以通过本地主机和端口,它应该工作。
您确定端口上确实有物品吗?
尝试:
远程登录127.0.0.1 8084
由于服务器绑定到我的IP地址而不是localhost或127.0.0.1,因此它在MAC中显示出来,它将不接受客户端连接到localhost / 127.0.0.1.。 当我用IP替换回送地址时,它工作正常。 奇怪,但猜测与MAC中的不同接口有关。 不确定Windows会如何反应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.