|
|
#include <sys/un.h>
UNIX domain addresses are pathnames. In other words, two processes can communicate by specifying the same pathname as their communications rendezvous point. The bind(SSC) operation creates an entry in the filesystem for the pathname specified. If the pathname already exists, the bind call will fail.
Sockets in the UNIX domain protocol family use the following addressing structure:
struct sockaddr_un { short sun_family; u_short sun_path[108]; };To create or reference a UNIX domain socket, the
sun_family
field should be
set to AF_UNIX and the sun_path
array
should contain the path name of a
rendezvous point.
Since there are no protocol numbers associated with UNIX domain sockets, the protocol argument to the socket call should be zero.
Closing a UNIX domain socket does not make the filesystem entry go away; an application should remove the entry using unlink(S) when finished.