Description |
|
To accept connections, a socket is first created with socket,
a queue for incoming connections is specified with listen,
and then connections are accepted with accept. The listen
call applies only to unconnected sockets of type SOCK_STREAM.
Note that you cannot call listen after accepthas been called. If the socket has not been bound to a local port
before the listen is invoked, the system automatically
binds a local port for the socket to listen on.
The listen queue is established for the socket specified
by the s parameter, which is a socket descriptor.
The backlog parameter defines the maximum allowable length of the
queue for pending connections. If a connection request arrives when
the queue is full, the client receives an ETIMEDOUT error.
The backlog parameter is limited (silently) to be in the range
of 1 to 128. If you specify any other value, the system automatically
assigns the closest value within range.
Return Value |
|
If the call is successful, 0 is returned. If the call fails, a -1 is returned, and an error code is stored in errno.
MPE/iX Specific |
|
The backlog limit on MPE/iX is 128 as opposed to the backlog limit
of 20 on HP-UX. When an HP-UX socket has performed a listen,
the incoming connection requests are completed as they are received
(up to the backlog limit). When using MPE/iX, connections
are completed by the call to accept.