![]() |
Accept() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: TCPSocket.h |
Declaration
BOOL Accept(
CTCPSocket* pNewSocket);
DescriptionAccept a connection, supply an already made socket
Function Body
try
{
//Quit if not ok
if (!CheckSocketValid())
return FALSE;
//First accept the socket
SOCKET aNewSocket;
//Where we are connected to
sockaddr_in aAddress;
//Size of the structure
int iSize;
iSize=sizeof(aAddress);
//Accept it
aNewSocket=accept(GetHandle(),
(sockaddr*)&aAddress,
&iSize);
//Is it OK
if (aNewSocket!=INVALID_SOCKET)
{
//Call before accept routing
pNewSocket->BeforeAccept();
//Set the socket data
pNewSocket->SetConnectedTo(aAddress);
pNewSocket->AssignSocket(aNewSocket);
pNewSocket->SetConnectionStatus(TRUE);
pNewSocket->Accepted();
//Exit
return TRUE;
}
else
{
//Error
SetLastError("Accept");
//Exit
return FALSE;
}
}
ERROR_HANDLER_RETURN("Accept",FALSE)
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |