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

The server (UNIX domain)

A completed connection is identified by a unique pair of sockets, each socket being an endpoint associated with one of the reciprocating processes. For the server to receive a client's connection, the server must issue two system calls after binding its socket. The first is to indicate a willingness to listen for incoming connection requests. The second is to accept the client's connect.

Consider the following example:

listen(s,5);

The second parameter, 5, indicates the maximum number of outstanding connections which can be queued awaiting the acceptance of the server. This limit prevents processes from tying up system resources. Should a connection be requested while the queue is full, the server does not refuse the connection, but ignores the messages which comprise the request. This forces the client to retry the connection request and gives the server time to make room in its queue. The listen call itself does not make the server process wait; it only specifies the maximum number of outstanding connection requests that can be queued.

Had the connection been returned with the ECONNREFUSED error, the client would be unable to tell if the server was up or not. See .!A dusockD.connection_errors for the list of errors.

The listen call is only used by passive processes. A passive process, such as a server process, can listen for calls and accept them, but cannot initiate them.


Next topic: Accepting a connection (UNIX domain)
Previous topic: Making a connection (UNIX domain)

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