![]() |
SendData() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Private Function |
Declared in: UDPRelay.h |
void SendData( const char* pBuffer, unsigned long ulBufferSize, IP aDestinationIP, unsigned short usDestinationPort);
Send data
try { //Search for the socket ConnectionData aData; aData.aSourceIP=aDestinationIP; aData.usSourcePort=usDestinationPort; //The socket CClientSocket* pSocket; pSocket=NULL; { //Lock the data CCriticalAutoRelease aRelease(m_pCSection); //Do we have it SocketMap::iterator aIterator; aIterator=m_aSocketMap.find(aData); if (aIterator!=m_aSocketMap.end()) //Save the socket pSocket=aIterator->second; } //Do we have the socket if (pSocket) //Send the data if (pSocket->SendData(pBuffer, ulBufferSize)<=0) //Report it ReportErrorOS("SendData","Failed to send data!"); else ; else { //Create the socket if (!(pSocket=CreateSocket(aDestinationIP, usDestinationPort))) //Report it ReportError("CreateSocket","Failed to create socket!"); else //Recall ourselves SendData(pBuffer, ulBufferSize, aDestinationIP, usDestinationPort); } } ERROR_HANDLER("SendData")
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |