In my recent project, I need to use the UDP protocol to transmit data.
If I send data by using size = s.sendto(data, (<addr>, <port>)), will the UDP protocol ensure that the data is packed into one UDP packet?
If so, will size == len(data) always be True?
Is there anything that I misunderstood?
More precisely, will 'sendto()' split my data into several smaller chunks and then pack each chunk into UDP packet to transimit?
The length of UDP packet is limited. If your data is too large, the return value can't equal the length.There are also some situations, such as not enough send buffer, network fault. The size only means the bytes that have been sent to send buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With