![]() |
Connect() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: SocketPool.h |
Declaration
BOOL Connect(
const std::string& rAddress,
unsigned short usPort,
CSocketPoolSocket* pSocket);
DescriptionAnother type of connect
Function Body
try
{
//Protect the socket
std::auto_ptr<CSocketPoolSocket> pProtection(pSocket);
//Are we closing
if (m_bClosing)
return TRUE;
//Set the connection data
pSocket->SetConnectionData(rAddress,
usPort);
//Lock the CSection
CCriticalAutoRelease aRelease(m_pCSection);
//Do we have enough space
if (m_iActiveSockets>=m_iMaxSocket)
{
//Can we add to queue
if (m_aQueue.size()>m_iMaxBackQueue)
return FALSE;
//Add the data to the queue
m_aQueue.push_back(pSocket);
//Release the protection
pProtection.release();
//Exit
return TRUE;
}
//Get the socket
++m_iActiveSockets;
//Exit the CS
aRelease.Exit();
//Try to connect
if (!pSocket->Connect())
{
//Check the reconnect
CheckQueue();
//Exit
return FALSE;
}
else
{
//Release the protection
pProtection.release();
//Exit
return TRUE;
}
}
ERROR_HANDLER_RETURN("Connect",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. |