Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
listen() z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference SC27-3660-00 |
|
The listen() call applies only to stream sockets. It performs two tasks: it completes the binding necessary for a socket s, if bind() has not been called for s, and it creates a connection request queue of length backlog to queue incoming connection requests. When the queue is full, additional connection requests are ignored. The listen() call indicates a readiness to accept client connection requests. It transforms an active socket into a passive socket. After called, s can never again be used as an active socket to initiate connection requests. Calling listen() is the third of four steps that a server performs when it accepts a connection. It is called after allocating a stream socket using socket(), and after binding a name to s using bind(). It must be called before calling accept().
If the backlog is less than 0, backlog is set to 0. If the backlog is greater than SOMAXCONN, as defined in the TCPIP.PROFILE file, backlog is set to SOMAXCONN. There is a SOMAXCONN variable in the SOCKET.H file that is hardcoded at 10. If your C socket programs use this variable to determine the maximum listen() backlog queue length, remember to change the header file to reflect the value you specified for TCP/IP in TCPIP.PROFILE. Return valuesThe value 0 indicates success;
the value -1 indicates an error. Errno identifies the specific error.
Related callsaccept(), bind(), connect(), socket() |
Copyright IBM Corporation 1990, 2014
|