Reputation: 2754
I have developed a udp server/client application in which server has one socket at which it continuously receives data from 40 clients. Now I want to know that what happens if all of the 40 Clients send data at a time? According to my understanding, data must be queued in receive buffer and next time when I call recvfrom() the data queued in the buffer is received i.e. I shall have to call recvfrom() 40 times to receive data of all the 40 Clients even if all the Clients sent data simultaneously. Also, I want to know that all of the data of 40 Clients will be queued in receive buffer or some of the data will be discarded too? Also, what is the maximum buffer size in which data can be queued in receive buffer and after what limit is data dropped?
Upvotes: 1
Views: 1763
Reputation: 2426
Indeed it all depends on the size of your OS socket buffers. In linux its fairly easy to configure, so all you probably need to do it to google how to change it for your Windows system.
Upvotes: 2
Reputation: 500167
I shall have to call recvfrom() 40 times to receive data of all the 40 Clients even if all the Clients sent data simultaneously.
In other words, you're asking whether separate UDP datagrams can be combined by the network stack. The answer is: no, they'll arrive as separate datagrams requiring separate calls to recvfrom()
.
Also, I want to know that all of the data of 40 Clients will be queued in receive buffer or some of the data will be discarded too?
UDP does not guarantee delivery. Packets can be dropped anywhere along the route: by the sending host, by any devices along the route and by the receiving host.
Also, what is the maximum buffer size in which data can be queued in receive buffer and after what limit is data dropped?
This is OS-dependent and is usually configurable. Bear in mind that packets might get dropped before even reaching the receiving host.
Upvotes: 2