【问题标题】:Netty UDT examples on amazon ec2亚马逊 ec2 上的 Netty UDT 示例
【发布时间】:2013-10-25 15:47:14
【问题描述】:

我不是网络专家,所以我可能遗漏了一些简单的东西。

我已经使用 netty 4.0.11 http://dl.bintray.com/netty/downloads/netty-4.0.11.Final.tar.bz2 将消息回显客户端和消息回显服务器构建为可运行的 jar 文件

我能够使用 maven 加载所有正确的依赖项,并且项目可以在本地和服务器上正确构建和运行。我可以在我的本地主机上运行一个服务器,并从同一个客户端(localhost,在我的本地机器和我的亚马逊 ec2 实例上)连接到它。它再次在我的机器和我的机器上连接到自身(localhost)服务器计算机。

问题是我无法从它正在运行的机器外部连接到服务器,例如,我想从本地计算机上运行的 echo msg 客户端连接到我的 echo msg 服务器(在我的 ec2 实例上运行) .

我已经设置了亚马逊安全设置,以允许来自正确端口和本地机器 ip 的 UDP。我在 ec2 实例上运行 Echo 服务器并正确启动:

REGISTERED
ACTIVE 
DATAGRAM LISTENING bind=/0.0.0.0:1234 peer=null:0

但我无法从本地主机外部连接,这是我从客户端机器收到的错误消息, 我还关闭了本地计算机上的所有防火墙(暂时)。不过,当我尝试连接时,我得到:

CONNECT(/70.36.197.242:1234, null)
10:11:17.000 [connect-0] DEBUG com.barchart.udt.EpollUDT - ep 1 rem [id: 0x3287e50e] DATAGRAM CONNECTING bind=/0.0.0.0:55005 peer=null:0
10:11:17.000 [connect-0] DEBUG com.barchart.udt.EpollUDT - ep 1 add [id: 0x3287e50e] DATAGRAM CONNECTING bind=/0.0.0.0:55005 peer=null:0 ERROR_WRITE
10/24/13 10:11:19 AM ===========================================================
udt.echo.message.MsgEchoClientHandler:
  rate:
             count = 0
         mean rate = 0.00 bytes/s
     1-minute rate = 0.00 bytes/s
     5-minute rate = 0.00 bytes/s
    15-minute rate = 0.00 bytes/s

10:11:20.017 [connect-0] WARN  com.barchart.udt.nio.SelectionKeyUDT - logic error : 
[id: 0x3287e50e] poll=ERROR_WRITE ready=---- inter=-C-- DATAGRAM CONNECTOR CONNECTING bind=/0.0.0.0:55005 peer=null:0
java.lang.Exception: Unexpected error report.
    at com.barchart.udt.nio.SelectionKeyUDT.logError(SelectionKeyUDT.java:436) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectionKeyUDT.doRead(SelectionKeyUDT.java:205) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectorUDT.doResultsRead(SelectorUDT.java:334) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectorUDT.doResults(SelectorUDT.java:309) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectorUDT.doEpollExclusive(SelectorUDT.java:234) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectorUDT.doEpollEnter(SelectorUDT.java:196) [barchart-udt-bundle-2.3.0.jar:na]
    at com.barchart.udt.nio.SelectorUDT.select(SelectorUDT.java:455) [barchart-udt-bundle-2.3.0.jar:na]
    at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:596) [netty-all-4.0.11.Final.jar:na]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:306) [netty-all-4.0.11.Final.jar:na]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [netty-all-4.0.11.Final.jar:na]
    at java.lang.Thread.run(Unknown Source) [na:1.7.0_06]
10:11:20.018 [connect-0] DEBUG com.barchart.udt.EpollUDT - ep 1 rem [id: 0x3287e50e] DATAGRAM CONNECTING bind=/0.0.0.0:55005 peer=null:0
10:11:20.018 [connect-0] ERROR c.barchart.udt.nio.SocketChannelUDT - connect failure : [id: 0x3287e50e] DATAGRAM CONNECTING bind=/0.0.0.0:55005 peer=null:0
10:11:20.018 [connect-0] INFO  i.n.handler.logging.LoggingHandler - [id: 0x53f0f817] CLOSE()
Exception in thread "main" java.io.IOException
    at com.barchart.udt.nio.SocketChannelUDT.finishConnect(SocketChannelUDT.java:236)
    at io.netty.channel.udt.nio.NioUdtMessageConnectorChannel.doFinishConnect(NioUdtMessageConnectorChannel.java:132)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:228)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:502)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:417)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)

【问题讨论】:

    标签: udp amazon netty udp-data-transfer


    【解决方案1】:

    没关系,在进行了更多故障排除后,我找到了解决方案。我必须除了在亚马逊安全设置中允许端口外,还要在服务器防火墙上允许 UDP 端口。

    【讨论】:

      猜你喜欢
      • 2010-12-28
      • 2014-10-08
      • 2014-03-30
      • 2020-05-12
      • 1970-01-01
      • 2013-11-24
      • 1970-01-01
      • 2013-07-18
      • 2015-10-22
      相关资源
      最近更新 更多