DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Interprocess communication using UNIX domain sockets

Making a connection (UNIX domain)

Once a process has bound a local socket, the process can rendezvous with an unrelated foreign process. Usually the rendezvous takes the form of a client server relationship. The client completes the other side of the socket pair when it requests services from the server, initiating a connection by issuing a connect call. Using the UNIX domain, this might appear as,

struct sockaddr_un server;
 ...
connect(s, (struct sockaddr *)&server, strlen(server.sun_path) +
    sizeof (server.sun_family));
where server would contain the UNIX pathname of the server to which the client process wishes to speak. If the socket of the client process is unbound when it issues the connect call, the system automatically selects a name and binds the socket. If the socket is successfully associated with the server, data transfer can begin. If not, an error is returned. See ``Connection errors (UNIX domain)'' for the list of errors.

The connect call is only used by active processes. An active process is a process that initiates a connection; a passive process, such as a server process, listens for calls and accepts them, but does not initiate them.


Next topic: The server (UNIX domain)
Previous topic: Binding socket names (UNIX domain)

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003