![]() |
CreateSocket() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Private Function |
Declared in: UDPRelay.h |
DeclarationCUDPRelay::CClientSocket * CreateSocket( IP aSourceAddress, unsigned short usSourcePort);
DescriptionCreate a socket
Function Body
try
{
//Create the socket
CClientSocket* pSocket;
pSocket=new CClientSocket(this,
aSourceAddress,
usSourcePort);
//Protect the socket
std::auto_ptr<CClientSocket> pProtection(pSocket);
//Try to create it
if (!pSocket->Create())
{
//Report it
ReportError("CreateSocket","Failed to create socket!");
//Exit
return NULL;
}
//Try to create it
if (!pSocket->Listen())
{
//Report it
ReportError("CreateSocket","Failed to create socket!");
//Exit
return NULL;
}
//Add the socket
ConnectionData aData;
aData.aSourceIP=aSourceAddress;
aData.usSourcePort=usSourcePort;
{
//Lock
CCriticalAutoRelease aRelease(m_pCSection);
//Insert the socket
m_aSocketMap.insert(SocketMap::value_type(aData,pSocket));
}
//Release the protection
pProtection.release();
//Done
return pSocket;
}
ERROR_HANDLER_RETURN("CreateSocket",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. |