Reputation: 363
Here is the situation: I have multiple clients and one host. The message format&size is specified. suppose all the clients send a message at the same time, that is N message are send to host.
My question is: will the host receive a mixed message, I mean will host receives some bits of message A and followed by some bits from message B ? Or the messages will be received in whole?
Thanks
Upvotes: 4
Views: 2930
Reputation: 41232
When you read data from the socket (e.g., with recvfrom
) all the data returned from that call will be from a single source.
Upvotes: 1
Reputation: 2804
UDP datagrams are always received by the 'end client' as a whole datagram. That is, if the sender sends a datagram of 10,000 bytes, it will be received as 10,000 bytes (and not some combination of smaller datagrams that add up to 10,000 bytes). The path taken by the datagram (namely IP) may cause the datagram to be fragmented during transmission, but the receiving UDP/IP stack will reassemble the datagram before delivery to an application program.
Upvotes: 5