简体   繁体   中英

How to receive concurrent udp socket response?

I want to create a client server UDP socket in c#. I succeed send and receive with single request response.

But I have a problem. When I send for example 5 requests concurrently. the response time of each request is different.

How can I understand each response is for which request ?

 var _connection = new UdpClient( port-to-listen-at );

 IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
 byte[] data = _connection.Receive(ref sender);

When Receive() returns 'sender', it contains sender-info

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