#include <cafe.h>
#include <cafe/network.h>

int SOListen(int fd, int backlog);


fd Descriptor of socket to which to listen.
backlog The maximum length of the queue of pending connections.

Return Values

0 upon success. Upon failure, -1 is returned and errno is set appropriately.


SO_ELIBNOTREADY Socket library is not initialized.
SO_ENOMEM Insufficient memory in the stack.
SO_ENOTSOCK The argument fd does not refer to a socket.
SO_EINVAL The socket is already connected, or in the process of being connected.
SO_EOPNOTSUPP The socket is not of a type that supports the SOListen operation.
SO_EADDRINUSE The address which was associated with fd is already in use.
SO_EBUSY Socket resource manager busy processing requests.
SO_EABORTED Indicates the operation was aborted. For example, this error can be returned for calls blocked on a socket after the socket is closed by another thread.
SO_EUNKNOWN Unknown error.
SO_ERANGEINVALID Internal API error, invalid error code.
SO_EAPIERROR Internal API error.


Listen for connections on a socket. This function only applies to sockets having type SOCK_STREAM.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also


Revision History

2012/10/09 Updated Errors section.
2012/08/16 Cleanup pass.
2011/07/11 Added Errors section.
2011/02/21 Initial version.