InetAccept Function  
 
SOCKET WINAPI InetAccept(
  SOCKET hSocket,  
  UINT nTimeout  
);

The InetAccept function is used to accept a client connection on a listening socket. If there are no pending connections, the function will block waiting for a connection request, or until the timeout period is reached.

Parameters

hSocket
Handle to the listening socket.
nTimeout
The number of seconds that the server will wait for the connection to complete before failing the operation.

Return Value

If the function succeeds, the return value is a handle to the socket. If the function fails, the return value is INVALID_SOCKET. To get extended error information, call InetGetLastError.

Remarks

When a connection is accepted by the server, the original listening socket continues to listen for more connections. The socket handle returned by InetAccept should be used to exchange information with the client.

To enable asynchronous event notification, use the InetEnableEvents function.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cswsock7.h.
Library: Use cswskav7.lib.

See Also

InetAsyncAccept, InetAsyncConnect, InetAsyncListen, InetConnect, InetEnableEvents, InetListen, InetReject