简体   繁体   English

获取UDP数据包的目标IP地址

[英]Get destination IP-address of UDP packet

When using the C# UDPClient to receive data, how do I determine if the received datagram was a broadcast packet or not? 使用C#UDPClient接收数据时,如何确定接收的数据报是否是广播数据包?

I can determine the source IP-address by reading the endpoint from UdpClient.Receive(endpoint), but I can't figure out how to get the remote IP-address of the packet. 我可以通过从UdpClient.Receive(端点)读取端点来确定源IP地址,但我无法弄清楚如何获取数据包的远程IP地址。 Is there a way to do that? 有没有办法做到这一点?

updClient.Client.RemoteEndPoint的类型为IPEndPoint ,具有Adrdress属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM