DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

unix(ADMP)


unix -- UNIX domain sockets

Syntax

#include <sys/un.h>

Description

The UNIX domain sockets facility provides for communication between processes running on the same UNIX system. Both SOCK_STREAM and SOCK_DGRAM types are supported. SOCK_STREAM provides for reliable communication. In most cases SOCK_DGRAM communication is also reliable because of the absence of a communication medium, however, use of SOCK_STREAM is encouraged.

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.

See also

bind(SSC), socket(SSC), unlink(S)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003