简体   繁体   English

网络引导程序连接被拒绝

[英]netty bootstrap connection refused

trying to connect client io.netty.bootstrap.Bootstrap : 尝试连接客户端io.netty.bootstrap.Bootstrap

ChannelFuture cf = null;
cf = m_bootstrap.connect(new InetSocketAddress(InetAddress
            .getByName("127.0.0.1"), 8084));

in cf, result : java.net.ConnectException: Connection refused: /127.0.0.1:8084 detailed message: 在cf中, resultjava.net.ConnectException: Connection refused: /127.0.0.1:8084详细消息:

[sun.nio.ch.SocketChannelImpl.checkConnect(Native Method), 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)] [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)]

my /etc/hosts file looks like this: 我的/ etc / hosts文件看起来像这样:

127.0.0.1>--localhost
255.255.255.255>broadcasthost
::1             localhost-
****::1%lo*>localhost
127.0.0.1>--********

Not sure what to do? 不知道该怎么办? literally assumed I can pass localhost and port and it should work. 从字面上假设我可以通过本地主机和端口,它应该工作。

Are you sure there is something really listing on the port ? 您确定端口上确实有物品吗?

Try: 尝试:

telnet 127.0.0.1 8084 远程登录127.0.0.1 8084

turns out in MAC since the server binds to my IP address and not localhost or 127.0.0.1 it would not accept the the client to connect to localhost/127.0.0.1. 由于服务器绑定到我的IP地址而不是localhost或127.0.0.1,因此它在MAC中显示出来,它将不接受客户端连接到localhost / 127.0.0.1.。 It worked fine when I replaced loopback addr with my IP. 当我用IP替换回送地址时,它工作正常。 Strange but guess it is something to do with difference interfaces in MAC. 奇怪,但猜测与MAC中的不同接口有关。 Not sure how Windows would react. 不确定Windows会如何反应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM