|
accept |
Top Previous Next |
|
The accept function permits an incoming connection attempt on a socket.
Syntax
Parameters socket A descriptor that identifies a socket that has been placed in a listening state with the listen function. The connection is actually made with the socket that is returned by accept.
addr An optional pointer to a buffer that receives the address of the connecting entity, as known to the communications layer. The exact format of the addr parameter is determined by the address family that was established when the socket from the sockaddr structure was created.
addrLen An optional pointer to an integer that contains the length of structure pointed to by the addr parameter.
Return value If no error occurs, accept returns the non-negative descriptor of the accepted socket, otherwise it returns -1. If an error occurs errno indicates the error. |