CAsyncSocket::Accept

This member function accepts a connection on a socket. This routine extracts the first connection in the queue of pending connections, creates a new socket with the same properties as this socket, and attaches it to rConnectedSocket. The accepted socket (rConnectedSocket) cannot be used to accept more 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.

Syntax

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

At a Glance

Header file: Afxsock.h
Platforms:
Versions: 2.0 and later
Complete documentation Visual C++ documentation

See Also

CAsyncSocket Overview, CAsyncSocket Member Functions, Windows Sockets Classes, CAsyncSocket::Bind, CAsyncSocket::Connect, CAsyncSocket::Listen, CAsyncSocket::Create, ::GetLastError