![]() |
Accept() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: TCPSocket.h |
DeclarationCTCPSocket * Accept();
DescriptionAccept a connection, create the socket class
Function Body
try
{
//Quit if not ok
if (!CheckSocketValid())
return FALSE;
//First accept the socket
SOCKET aSocket;
//Where we are connected to
sockaddr_in aConnected;
//Size of the structure
int iSize;
iSize=sizeof(aConnected);
//Accept it
aSocket=accept(GetHandle(),
(sockaddr*)&aConnected,
&iSize);
//Is all OK
if (aSocket!=INVALID_SOCKET)
{
//Create the new tcp socket
CTCPSocket* pSocket;
pSocket=new CTCPSocket(aSocket);
//Set the address
pSocket->SetConnectedTo(aConnected);
pSocket->SetConnectionStatus(TRUE);
//Done
return pSocket;
}
else
{
//Error
SetLastError("Accept");
//Exit
return NULL;
}
}
ERROR_HANDLER_RETURN("Accept",NULL)
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. |