#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) function 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 { u_char sun_len; u_char sun_family; u_short sun_path[108]; };To create or reference a UNIX domain socket, the
sun_len
field should be set to the length of the
sockaddr_un structure or the length of the structure containing
valid information (that is, up to and including the terminating zero byte in
sun_path
). 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.
family
member has been shortened to 8 bits and
a new 8-bit member inserted before it called len
. For more
information on the new sockaddr structures, see also:
inet(ADMP).