Receiving a response through UDP

后端 未结 3 2046
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 18:52

I have seen applications send a packet through UDP to an IP on some port and receiving a response. Which port does the response go to? (Btw, how can the router know that the

3条回答
  •  一生所求
    2021-01-04 19:45

    If I send a message to a UDP port on another machine, whichever port I send the message from, no matter how it is selected, will appear in the UDP datagram. I would have thought that the remote end would send any response to that datagram to that source port.

    I suppose the same applies even if ports are changed by firewall or NAT device, the remote end sees a datagram from a particular port and sends the reply back, the firewall/NAT device then translates that port to the original source port.

提交回复
热议问题