开发者

How do you write a UDP port forwarder?

开发者 https://www.devze.com 2023-02-16 02:36 出处:网络
As UDP is a connectionless protocol, once the forwarder gets a packet and sends it to a target ip, and the target ip respo开发者_StackOverflownds with data, how can the forwarder know what ip to send

As UDP is a connectionless protocol, once the forwarder gets a packet and sends it to a target ip, and the target ip respo开发者_StackOverflownds with data, how can the forwarder know what ip to send the packet to?


If you are talking about a standard gateway, it knows where to send it because the packet has a destination IP address and port.

If you are talking about NAT, then the router must remember what it has recently sent out and accept corresponding incoming packets. The router maintains a session internally, which will stay alive for some configured period.

0

精彩评论

暂无评论...
验证码 换一张
取 消