tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How (un)reliable are local domain sockets?



On Tue, Jul 30, 2013 at 10:43:21PM +0200, Jan Danielsson wrote:
> Hello,
> 
>    Say I'm adding the necessary ACK's, retries, etc to a UDP based
> protocol, and I want to support local domain sockets as well (also
> SOCK_DGRAM). Do I need to keep the "error handling" from the UDP code,
> or are local domain sockets guaranteed to be successful as long as
> sendto() was successful?

You want to be careful with this.  Though on BSD implementations, local
sockets have always been reliable, you have no such guarantee on mutant
Unices such as Linux.

In particular, Linux is prone to reorder messages on local
sockets and in some cases can drop them.  If you want to indicate
to the kernel expressly that you don't countenance such behavior, you
can use SOCK_SEQPACKET rather than SOCK_DGRAM, but, then
your code may not compile...

Thor


Home | Main Index | Thread Index | Old Index