*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> listen (2)              



NAME    [Toc]    [Back]

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

SYNOPSIS    [Toc]    [Back]

       #include <sys/socket.h>

       int listen(
               int socket,
               int backlog );

STANDARDS    [Toc]    [Back]

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

       listen(): XNS4.0, XNS5.0

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

PARAMETERS    [Toc]    [Back]

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

DESCRIPTION    [Toc]    [Back]

       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 kernel
       attribute in the socket subsystem. Use  the  sysconfig  -q
       socket somaxconn to obtain this value from the kernel. See
       sys_attrs_socket(5) for more information.

       The socket in use may require that the process have appropriate
 privileges to use the listen() function.

RETURN VALUES    [Toc]    [Back]

       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    [Toc]    [Back]

       If the listen() function fails, errno may be set to one of
       the following values: The requested address  is  protected
       and the current process does not have permission to access
       it.  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;  or the socket is shut down.  Insufficient
 resources are available in the  system  to  complete
       the  call.   The  socket parameter refers to a file, not a
       socket.  The referenced socket is not a type that supports
       the listen() function.

SEE ALSO    [Toc]    [Back]

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

       Standards: standards(5)

       Network Programmer's Guide

[ Back ]
 Similar pages
Name OS Title
listen OpenBSD listen for connections on a socket
listen NetBSD listen for connections on a socket
listen IRIX listen for connections on a socket
listen Linux listen for connections on a socket
listen HP-UX listen for connections on a socket
listen FreeBSD listen for connections on a socket
listen IRIX listen for connections on a socket
accept_filter FreeBSD filter incoming connections
pppoed FreeBSD handle incoming PPP over Ethernet connections
accf_data FreeBSD buffer incoming connections until data arrives
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service