I know that UDP is inherently unreliable, but when connecting to localhost I would expect the kernel handles the connection differently since everything can be handled internally. So in this special case, is UDP considered a reliable protocol, or will the kernel still potentially junk some packets if buffers are overrun?
UDP is a transport layer network protocol. The transport layer is responsible for getting data from one point on the network to another specific point on the network. In that context, UDP is described as an "unreliable" protocol because it makes no guarantees about whether the data sent will actually arrive.
UDP is a a lossy unreliable protocol which runs on top of the IP protocol. Unlike TCP (which handles all aspects of reliable communication) it is up to the application layer to handle dropped packets and other aspects of a "reliable" transport protocol.
UDP is an unreliable, connectionless, fast transport protocol used for sending short messages or messages that do not require acknowledgement of receipt. An easy way to remember the difference is: TCP is Trustworthy; UDP is Unreliable.
The UDP packet loss is especially affected by TCP traffic and its flow control mechanism. This is because TCP flow control continues to increase its window size until packet loss occurs if the advertised window size is large enough.
I have seen UDP to localhost dropping packets. We think we were overloading the kernel queue. All we know for sure is that it was dropping packets.
I repeat a previous answer to a related question. To remain portable always anticipate your UDP sockets might drop packets or receive out of order data.
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