C# UDP Socket: Get receiver address

前端 未结 5 1666
萌比男神i
萌比男神i 2020-12-29 07:04

I have an asynchronous UDP server class with a socket bound on IPAddress.Any, and I\'d like to know which IPAddress the received packet was sent to (...or received on). It

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 07:34

    I think that if you bind to 127.0.0.1 instead of IPAddress.Any you'll get the behavior that you want.

    0.0.0.0 deliberately means "every IP address available" and it takes it very literally as a consequence of your bind statement.

提交回复
热议问题