It seems there\'s atleast 3 different local/unix socket types (AF_UNIX
) , SOCK_STREAM
, SOCK_DGRAM
and SOCK_SEQPACKET
.
I think the main difference here is that SOCK_SEQPACKET
is conneciton-oriented, while SOCK_DGRAM
is not.
This will mostly matter on the server side of the connection (the process that listens on the UNIX socket) when there are multiple client processes talking to it:
With SOCK_DGRAM
, you would get interleaved client datagrams directly on the listening socket. With SOCK_SEQPACKET
, you would spawn a separate client socket for each client using accept
, thus receiving datagrams from each client separately.
Quoting man 3 accept
:
The accept() system call is used with connection-based socket types (SOCK_STREAM, SOCK_SEQPACKET).