简体   繁体   English

在C#中有多少个客户端连接到指定的UDP端口号

[英]How many clients are connected to specified UDP port number in c#

如何计算C#中连接到UDP套接字的客户端数量?

You can use IPGlobalProperties and one of these methods 您可以使用IPGlobalProperties和以下方法之一

IPGlobalProperties.GetUdpIPv4Statistics

Provides User Datagram Protocol/Internet Protocol version 4 (UDP/IPv4) statistical data for the local computer. 提供本地计算机的用户数据报协议/ Internet协议版本4(UDP / IPv4)统计数据。

for ipv6 there is also another function 对于ipv6,还有另一个功能

UDP is a connectionless protocol, so there are no connections to count. UDP是无连接协议,因此没有连接要计数。 IPGlobalProperties.GetUdpIPv4Statistics only gives you the number of listerners on the system, which I don't think is what you are looking for. IPGlobalProperties.GetUdpIPv4Statistics仅为您提供系统上侦听人员的数量,我认为这不是您想要的。 It would be helpful if you specify what you are trying to do! 如果您指定要执行的操作,将很有帮助!

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

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