Listen ()

Source: Internet
Author: User

Creates a set of interfaces and listens for requested connections. #include <winsock.h>int PASCAL Far listen (SOCKET s, int backlog); S: A descriptive word used to identify a bundled, disconnected socket interface. Backlog: The maximum length to wait for the connection queue.
Chinese name
Listen ()
Brief
create a set of interfaces and listen for requested connections
Comments
In order to accept the connection
Compatibility
fallback log is currently limited to 5
Directory
    1. 1 Notes
    2. 2 Compatibility
    3. 3 return value
    4. 4 Error Codes
comment editing In order to accept the connection, a socket () is used to create a descriptor for a set of interfaces, then a socket is created with listen () and a fallback log is established for the connection requested, and then the Accept () accepts the connection. Listen () applies only to socket interfaces that support connections, such as the Sock_stream type. The socket S is in a "change" mode, and the requested connection request is confirmed and queued for acceptance. This function is especially useful for servers with multiple connection requests at the same time, and if the queue is full when a connection request arrives, the customer will receive a wsaeconnrefused error. When no descriptors are available, the listen () function still tries to work properly. It still accepts requests until the queue becomes empty. When a descriptive word is available, a subsequent listen () or accept () call will repopulate the queue with the current or most recent "fallback log", and, if possible, resume the connection request that the listener requests to enter.Compatibility Editor The fallback log is currently limited (by default) to 5. As in 4.3 BSD unix, a number less than 1 or greater than 5 will be rounded to the nearest valid value.return value edit If no error occurs, listen () returns 0. Otherwise, the SOCKET_ERROR error is returned, and the application can get the corresponding error code via WSAGETLASTERROR ().error code editing Wsanotinitialised: You should first successfully call WSAStartup () before using this API. The Wsaenetdown:windows socket interface realizes the network sub-system failure. Wsaeaddrinuse: Try to use listen () to listen for an address that is in use. Wsaeinprogress: A blocked Windows Socket interface call is running. Wsaeinval: The set of interfaces is not bundled with bind () or has been connected. Wsaeisconn: The socket interface has been connected. Wsaemfile: No file description word available. WSAENOBUFS: No buffer space available. Wsaenotsock: The description word is not a set of interfaces. Wsaeopnotsupp: The set of interfaces is not normal listen () call.

Listen ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.