将UDP数据包发送到另一个网络中的节点 [英] Send UDP packets to a node in another network

查看:171
本文介绍了将UDP数据包发送到另一个网络中的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将UPD数据包从节点A发送到节点B,两者均通过不同的路由器连接到Internet. 当它们连接在同一网络上时,通过提供本地目标IP地址(192.168..)和端口号,我能够在它们之间发送(和接收)UDP数据包.

I'm trying to send UPD packets from node A to node B, both are connected to internet through different routers. I am able to send (and receive) UDP packets between them when they connected on the same network by giving the local destination ip adddress (192.168..) and port number.

现在我正在使用www.whatismyip.com查找节点B的动态IP地址,并将其视为w.x.y.z 当我将数据包从A发送到此目的地时,我无法在B处接收它们.我还在两个路由器上都设置了端口转发.

Now I'm finding the dynamic ip address of node B using www.whatismyip.com and consider it as w.x.y.z When I send the packets from A to this destination, I'm unable to receive them at B. I've also setup port forwarding on both the routers.

这对我来说是全新的.当我想将数据包发送到另一个网络上连接的节点时,还有其他需要做的事情吗?请帮忙!

This is completely new to me. Is there is something else that needs to be done when I want to send packets to a node connected on another network? Please help!!

推荐答案

您无法在B处接收它们的原因是,如果您未在netfilter的表中建立连接,则NAT会过滤所有消息.解决问题的方法是使用端口映射,例如UPNP或NAT-PMP.这样,目标节点的特定端口将接收来自WLAN的任何消息并将其发送到该节点.但这需要您的路由器支持这些协议,否则,也许您需要使用ICE作为真正的服务器来实现它.

The thing that you can not receive them at B is because NAT will filter all the messages if you haven't build a connection in the netfilter's table. The way to solve the problem is to use a port mapping like UPNP or NAT-PMP. In this way, the destination node's specific port will receive any message from WLAN and send it to this node. But this needs your router support these protocols, if not, maybe you need to use ICE as a realy server to realize it.

这篇关于将UDP数据包发送到另一个网络中的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆