InetAccept
SOCKET 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; a value of zero indicates that the server should wait an indefinite period of time.

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 Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cswsock6.h.
Library: Use cswskav6.lib.

See Also

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


Copyright © 2008 Catalyst Development Corporation. All rights reserved.