Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何为 udpclient 指定特定的 ipaddress:port 接收?我对 updclient.client.localendpoint 和 udpclient.client.remoteendpoint 感到困惑。我在想可能是它的远程端点,但我无法显示远程端点值。加上我的本地端点 ip 是 0.0.0.0。那什么意识?
0.0.0.0 表示“任何地址”。本地端点是您将侦听数据包的 IP 地址和端口。UdpClient 对象不需要远程端点。如果在发送数据包时不指定一个,它只指定发送数据包的默认主机。
如果您想在所有网络连接上侦听您分配的所有 IP 地址上的流量,您可以将本地端点保留为 0.0.0.0。如果您只想监听一个特定的地址/连接,您只需要更改此设置。