mtcp_listen

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
AUTHORS
SEE ALSO
COLOPHON

NAME

mtcp_listen − listen for connections on an mTCP socket

SYNOPSIS

#include <mtcp_api.h>

int mtcp_listen(mctx_t mctx, int sockid, int backlog);

DESCRIPTION

mtcp_listen() marks the mTCP socket referred to by sockid as a passive socket of type SOCK_STREAM. Once this function is called on a mTCP socket, it is ready to start accepting incoming connection requests.

The backlog argument is used to set the maximum length of the queue that the passive socket, referred to by sockid can accomodate for pending connections requests.

mtcp_listen() call takes an additional argument named mctx that represents the per-core mTCP context in an application (see mtcp_create_context() for details).

RETURN VALUE

Returns 0 on success; -1 on failure. In case of failure, errno is set appropriately.

ERRORS

EADDRINUSE

Another socket is already listening on the same port.

EBADF

sockid is not a valid socket descriptor.

EINVAL

The backlog argument is either <= 0 or exceeds the maximum conneciton concurrency limit as set by the mTCP startup configuration file (see mtcp_init() for details).

ENOMEM

There is not enough available memory to create the listening backlog queue.

ENOTSOCK

The socket referred to by sockid is not valid.

AUTHORS

mTCP development team <[email protected]>

SEE ALSO

mtcp_bind(), mtcp_socket(), mtcp_accept(), mtcp_connect(), mtcp_read(), mtcp_write()

COLOPHON

This page is part of mTCP release 3.0 docs section. A description of the project, and information about reporting bugs, can be found at http://shader.kaist.edu/mtcp/.