Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用camel netty tcp与远程主机通信_Tcp_Apache Camel_Netty - Fatal编程技术网

使用camel netty tcp与远程主机通信

使用camel netty tcp与远程主机通信,tcp,apache-camel,netty,Tcp,Apache Camel,Netty,我有一个在远程主机上运行的程序,我需要连接到它,握手,然后监听消息。我已设置以下骆驼路线: <route> <from uri="netty:tcp://localhost:50001?decoders=#decoders&amp;sync=false" /> <bean ref="TransformMessage" method="inboundDecoder" /> <to uri="eventadmin:messages/

我有一个在远程主机上运行的程序,我需要连接到它,握手,然后监听消息。我已设置以下骆驼路线:

<route>
   <from uri="netty:tcp://localhost:50001?decoders=#decoders&amp;sync=false" />
   <bean ref="TransformMessage" method="inboundDecoder" />
   <to uri="eventadmin:messages/aacus/inbound" />
</route>

<route>
   <from uri="eventadmin:messages/aacus/outbound" />
   <bean ref="TransformMessage" method="outboundEncoder" />
   <to uri="netty:tcp://192.168.0.111:50001?allowDefaultCodec=false&amp;sync=false" />
</route>

我的问题是我如何使这项工作?如果我使用

它因绑定错误而失败


如何设置连接以在不修改服务器的情况下在特定端口上响应?

撰写本文时,无论是camel mina还是camel netty,都不可能做到这一点。使用者只能绑定到本地服务器。Apache有一张JIRA的票,可以在将来实现这样一个新特性

使用以下解决方法:

使用本地主机代替ob
192.168.0.111
。 然后安装“socat”并按如下方式启动

socat -s -u tcp4:192.168.0.111:50001 tcp4:localhost:50001

这将通过隧道将您的远程连接连接到您使用camel/netty创建的本地服务。

谢谢克劳斯,我恐怕是这样的。令人沮丧的是,这似乎是一个常见的、显而易见的用例,因此没有得到支持。我已经解决了这个问题,为Camel实现了一个自定义组件,用于处理我的TCP通信。