How reliable are unix domain sockets?
Asked Answered
G

1

9

I'm trying to figure out a protocol to use with domain sockets and can't find information on how blindly the domain sockets can be trusted.

Can data be lost? Are messages always received in the same order as sent? Even when using datagram sockets?

Are transfers atomic? When reading the socket, can I trust that I get the whole message on one read or do I have to check it myself?

Geomorphology answered 14/10, 2009 at 15:13 Comment(0)
B
13

From 'man AF_UNIX':

Valid types are: SOCK_STREAM, for a stream-oriented socket and SOCK_DGRAM, for a datagram-oriented socket that preserves message boundaries (as on most Unix implementations, Unix domain datagram sockets are always reliable and don’t reorder datagrams);

Breland answered 14/10, 2009 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.