O
O
Olegtm2022-01-03 01:15:45
UDP
Olegtm, 2022-01-03 01:15:45

How many clients can simultaneously transmit data on one UDP port (windows)?

There is a server (C#, Windows) that receives and transmits messages via UDP to a large number of devices> 10000
Question: can they all work through one port?
In TCP, after a connection is established, each device receives its own socket, and reading / data transfer is "parallelized" in a natural way.
How about in UDP? It looks like the data is being read sequentially, one after the other...
Or am I missing something?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
4
4X_Pro, 2022-01-03
@XXXXPro

That's right: there are no connections in UDP, there is an exchange of data in independent packets. All these packets arrive on the same socket, even if the senders are different. Reading from this socket proceeds sequentially in the order of arrival of packets. You also need to keep in mind that if there are a lot of packets, and they are processed slowly, it is possible that the operating system does not have enough buffers to receive new packets, and they will start to be lost.
To understand who the packet is from and what to do with it, you need to either pass some sender identifier in the data itself, or use the recvfrom function instead of recv. It receives not only the packet itself, but also the sender's IP address.

V
vreitech, 2022-01-03
@fzfx

Question: can they all work through one port?
If the port is understood as the incoming UDP port of the server, then they can.
In TCP, after a connection is established, each device receives its own socket
In UDP it is the same (a socket is formed), only there is no connection establishment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question