I'm building a server that use UDP protocol to send and receive UDP message to and from clients. Clients continuously "throw" UDP message to server without server responding anything, when the server "think" that it had received enough UDP messages from certain client, it will send a signal message (UDP message) back to THE client (this time, client acts as an server) to prevent it from sending any more messages. The problem here is that: The server can receive UDP messages from clients. But clients (which is behind LAN network) can't receive UDP messages from server. How can I send UDP messages to a client that is behind LAN network?
我正在构建一个使用UDP协议向客户端发送和接收UDP消息的服务器。客户端不断向服务器“抛出”UDP消息而服务器没有任何响应,当服务器“认为”它已从某个客户端收到足够的UDP消息时,它会向客户端发送一条信号消息(UDP消息)(这次,客户端)充当服务器)以防止它再发送任何消息。这里的问题是:服务器可以从客户端接收UDP消息。但客户端(位于LAN网络后面)无法从服务器接收UDP消息。如何将UDP消息发送到LAN网络后面的客户端?
1 个解决方案
#1
That depends on the router, Some would set a route for some time when the datagram is 1st send by the LAN member to the server, the router might take note as the udp packet is part of a 'UDP Session' and route it accordingly. The other way I'd try is utilizing UPnP to forward the correct port (I.E. the port that the client machine is using) to the LAN member.
这取决于路由器,有些人会在数据报首次由LAN成员发送到服务器时设置路由一段时间,路由器可能会记录,因为udp数据包是“UDP会话”的一部分并相应地路由它。我尝试的另一种方法是利用UPnP将正确的端口(I.E.客户端机器正在使用的端口)转发给LAN成员。
#1
That depends on the router, Some would set a route for some time when the datagram is 1st send by the LAN member to the server, the router might take note as the udp packet is part of a 'UDP Session' and route it accordingly. The other way I'd try is utilizing UPnP to forward the correct port (I.E. the port that the client machine is using) to the LAN member.
这取决于路由器,有些人会在数据报首次由LAN成员发送到服务器时设置路由一段时间,路由器可能会记录,因为udp数据包是“UDP会话”的一部分并相应地路由它。我尝试的另一种方法是利用UPnP将正确的端口(I.E.客户端机器正在使用的端口)转发给LAN成员。