SYS_LISTEN


Listens for connections on a socket.

To accept connections, a socket is first created with SYS_SOCKET, a willingness to accept incoming connections and a queue limit for incoming connections are specified with SYS_LISTEN, and then the connections are accepted with SYS_ACCEPT. The SYS_LISTEN call applies only to sockets of type SOCK_STREAM or SOCK_SEQPACKET.

Arguments:

1st Socket descriptor.
2nd

Queue length for completely established sockets waiting to be accepted. The maximum length of the queue for incomplete sockets can be set using the tcp_max_syn_backlog sysctl. When syncookies are enabled there is no logical maximum length and this sysctl setting is ignored. See man 7 tcp for more information.

If the socket is of type AF_INET, and this argument is greater than the constant SOMAXCONN (128 in Linux 2.6), it is silently truncated to SOMAXCONN.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EADDRINUSE Another socket is already listening on the same port.
-EBADF The 1st argument is not a valid descriptor.
-ENOTSOCK The 1st argument is not a socket.
-EOPNOTSUPP The socket is not of a type that supports the SYS_LISTEN operation.

Remarks

n/a

Compatibility

n/a