简体   繁体   中英

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

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

You can use IPGlobalProperties and one of these methods

IPGlobalProperties.GetUdpIPv4Statistics

Provides User Datagram Protocol/Internet Protocol version 4 (UDP/IPv4) statistical data for the local computer.

for ipv6 there is also another function

UDP is a connectionless protocol, so there are no connections to count. IPGlobalProperties.GetUdpIPv4Statistics only gives you the number of listerners on the system, which I don't think is what you are looking for. It would be helpful if you specify what you are trying to do!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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