![]() |
CreateSocket() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: UDPRelay.h |
CUDPRelay::CClientSocket * CreateSocket( IP aSourceAddress, unsigned short usSourcePort);
Create a socket
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)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |