Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
listen(2) OSS System Calls Reference Manual
For more information about AF_UNIX Release 2 sockets, portability mode, and compatibility
mode, see the Open System Services Programmer’s Guide.
NOTES
This function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specified
when you compile the module.
RETURN VALUES
Upon successful completion, the listen() function returns the value 0 (zero). Otherwise, the
value -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the listen() function sets errno to the corresponding
value:
[EBADF] The socket parameter is not a valid file descriptor.
[ECONNRESET]
One of the following conditions occurred:
• The transport-provider process for this socket is no longer available.
• The TCP/IP subsystem for this socket is no longer available.
• The connection was forcibly closed by the peer socket.
The socket can only be closed.
[EDESTADDRREQ]
The socket is not bound to a local address, and the protocol does not support
listening on an unbound socket.
[EINVAL] One of the following conditions occurred:
• The socket is already connected.
• The socket has been shut down.
[ENOBUFS] There was not enough buffer space available to complete the call. A retry at a
later time may succeed.
[ENOMEM] Required memory resources were not available. A retry at a later time may
succeed.
[ENOTSOCK] The socket parameter does not refer to a socket.
[EOPNOTSUPP]
The socket specified by the socket parameter is not a type that supports the
listen() function.
RELATED INFORMATION
Functions: accept(2), connect(2), socket(2).
STANDARDS CONFORMANCE
The following are HP extensions to the XPG4 specification:
• The errno value [ECONNRESET] can be returned when the transport provider process
is unavailable.
• The behavior when the backlog parameter is 0 (zero) is defined.
4−20 Hewlett-Packard Company 527186-023