![]() |
CAcceptSocket::OnSocketAccept() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
Private Function (Not Declared) |
Declared in: TCPRelay.h |
Declaration
BOOL CAcceptSocket::OnSocketAccept(
int iErrorCode);
Function Body
try
{
//Do we have an error
if (iErrorCode)
{
//Report it
ReportError("OnSocketAccept","Had an error code!",iErrorCode);
//Done
return FALSE;
}
//Accept a new socket
CClientSocket* pSocket;
pSocket=new CClientSocket(m_pFather,
NULL);
//Protect if
std::auto_ptr<CClientSocket> pProtection(pSocket);
//Try to accept
if (!Accept(pSocket))
{
//Report it
ReportErrorOS("OnSocketAccept","Failed to accept socket!");
//Exit
return FALSE;
}
//Create a new socket for it (opposite socket)
CClientSocket* pOutgoingSocket;
pOutgoingSocket=new CClientSocket(m_pFather,
pSocket);
//Protect if
std::auto_ptr<CClientSocket> pProtection2(pOutgoingSocket);
//Try to create it
if (!pOutgoingSocket->Create())
{
//Report it
ReportErrorOS("OnSocketAccept","Failed to create socket!");
//Exit
return FALSE;
}
//Set the other socket
pSocket->SetSocket(pOutgoingSocket);
//Release protections
pProtection.release();
pProtection2.release();
//Connect the socket
pSocket->Connect();
//Done
return TRUE;
}
ERROR_HANDLER_RETURN("OnSocketAccept",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. |