Content-type: text/html Man page of listen

listen

Section: System Calls (2)
Index Return to Main Contents
 

NAME

listen - Listens for socket connections and limits the backlog of incoming connections  

SYNOPSIS

#include <sys/socket.h>

int listen (        int socket,
       int backlog );
 

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows:

listen(): XPG4-UNIX

Refer to the standards(5) reference page for more information about industry standards and associated tags.

 

PARAMETERS

Specifies the unique name for the socket. Specifies the maximum number of outstanding connection requests.  

DESCRIPTION

The listen() function identifies the socket that receives the connections, marks the socket as accepting connections, and limits the number (backlog) of outstanding connection requests in the system queue.

The maximum queue length (backlog) that the listen() function can specify is indicated by the SOMAXCONN value in the sys/socket.h header file.  

RETURN VALUES

Upon successful completion, the listen() function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to indicate the error.  

ERRORS

If the listen() function fails, errno may be set to one of the following values: The socket parameter is not valid. The socket is not bound to a local address, and the protocol does not support listening on an unbound socket. The socket is already connected. The socket parameter refers to a file, not a socket. The referenced socket is not a type that supports the listen() function.  

RELATED INFORMATION

Functions: accept(2), connect(2), socket(2)

Standards: standards(5) delim off


 

Index

NAME
SYNOPSIS
STANDARDS
PARAMETERS
DESCRIPTION
RETURN VALUES
ERRORS
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:18 GMT, October 02, 2010