CAsyncSocket::Accept

This method accepts a connection on a socket. This routine extracts the first connection in the queue of pending connections, creates a duplicate socket and attaches it to rConnectedSocket. The accepted socket (rConnectedSocket) cannot be used to accept additional connections. The original socket remains open and listening. If no pending connections are present on the queue, Accept returns zero and GetLastError returns an error.

At a Glance

Header file: Afxsock.h
Platforms: H/PC 2.0, Palm-size PC, H/PC Pro
Windows CE versions: 2.0 and later
Complete documentation: Visual C++ documentation

Syntax

virtual BOOL Accept( CAsyncSocket& rConnectedSocket,
SOCKADDR*
lpSockAddr = NULL, int* lpSockAddrLen = NULL );

See Also

CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::Create, GetLastError