Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is sending data via UDP sockets on the same machine reliable?

If i use UDP sockets for interprocess communication, can i expect that all send data is received by the other process in the same order?

I know this is not true for UDP in general.

like image 882
Lothar Avatar asked Jan 24 '10 20:01

Lothar


People also ask

Is UDP reliable or unreliable?

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.

Can UDP send and receive on same socket?

TCP vs UDP Once connected, a TCP socket can only send and receive to/from the remote machine. This means that you'll need one TCP socket for each client in your application. UDP is not connection-based, you can send and receive to/from anyone at any time with the same socket.

How reliable is UDP on a LAN?

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.

Is UDP on localhost reliable?

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.


1 Answers

No. I have been bitten by this before. You may wonder how it can possibly fail, but you'll run into issues of buffers of pending packets filling up, and consequently packets will be dropped. How the network subsystem drops packets is implementation-dependent and not specified anywhere.

like image 114
Brian Agnew Avatar answered Sep 22 '22 17:09

Brian Agnew