我正在使用 netty + udt + 集合点测试此示例的修改版本:http: //netty.io/4.0/xref/io/netty/example/udt/echo/rendezvous/package-summary.html
我已经在我的服务器和本地机器上启动了一个实例,其中“self”-host 是双方的 localhost,“peer”-host 是另一个的主机名。所以A绑定到localhost并连接到B,B绑定到localhost并连接到A。
在 LAN 中一切正常,但当我连接位于防火墙(fritzbox 路由器)和我的服务器后面的计算机时却不行。(服务器不会阻止端口)。在这种情况下会发生超时:
在双方我看到:
java -jar out/artifacts/LearningJavaAgain_jar/LearningJavaAgain.jar <host_name>
Jul 31, 2014 3:23:34 PM io.netty.handler.logging.LoggingHandler channelRegistered
INFORMATION: [id: 0xdd7790d7] REGISTERED
Jul 31, 2014 3:23:34 PM io.netty.handler.logging.LoggingHandler connect
INFORMATION: [id: 0xdd7790d7] CONNECT(xx.xxx.xxx.xxx:5555, localhost/127.0.0.1:5555)
Jul 31, 2014 3:24:04 PM io.netty.handler.logging.LoggingHandler close
INFORMATION: [id: 0xdd7790d7] CLOSE()
Exception in thread "main" io.netty.channel.ConnectTimeoutException: connection timed out: xx.xxx.xxx.xxx:5555
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:214)
at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:123)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Jul 31, 2014 3:24:04 PM io.netty.handler.logging.LoggingHandler channelUnregistered
INFORMATION: [id: 0xdd7790d7] UNREGISTERED
我以为 netty+udt 做 udp 打孔,不是吗?