C
Description
The accept function is used to accept connection requests queued for a listening socket. If a connection request is pending, accept removes the request from the queue, and a new socket is created for the connection. The original listening socket remains open and continues to queue new connection requests. The socket must be a SOCK_STREAM type socket.
Preconditions
listen function should be called.
Parameters
Parameters |
Description |
s |
Socket descriptor returned from a previous call to socket. must be bound to a local name and in listening mode. |
addr |
Optional pointer to a buffer that receives the address of the connecting entity. |
addrlen |
Optional pointer to an integer that contains the length of the address addr |
Returns
If the accept function succeeds, it returns a non-negative integer that is a descriptor for the accepted socket. Otherwise, the value INVALID_SOCKET is returned.
Remarks
None.