![]() |
OnSocketReceive() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Protected Function |
Declared in: PingSocket.h |
virtual BOOL OnSocketReceive( int iErrorCode);
try { //Receive the data, and check if it's our ping if (CICMPSocketAsync::OnSocketReceive(iErrorCode)) { //Check if it is our ping if ((IsIDOK(GetLastICMPHeader()->sICMP.sUS.us1, GetLastICMPHeader()->sICMP.sUS.us2) && GetLastICMPHeader()->ucICMPType==ICMP_Echo_Reply) || GetLastICMPHeader()->ucICMPType==ICMP_Time) { //Do we have a timer ? if (m_dwTimeout) //Reset the timeout CAsyncSocket::KillTimer(); //Save some data //Time it took m_dwTimeElapsed=GetTickCount()-m_dwLastTick; //Save the TTL m_ucTTL=GetLastIPHeader()->ucTTL; //Get the data size m_iDataSize=GetLastDataSize(); //Replying address m_aReplyingAddress=GetLastIPHeader()->ulSourceAddress; //Set ping done m_bPingDone=TRUE; //No timeout m_bTimeout=FALSE; //Ping is done PingDone(FALSE); //What is the sequence unsigned short usSequence; if (GetLastICMPHeader()->ucICMPType==ICMP_Time) usSequence=GetLastICMPICMPHeader()->sICMP.sUS.us1; else usSequence=GetLastICMPHeader()->sICMP.sUS.us1; //Ping is done with data PingDoneData(m_aReplyingAddress, m_ucTTL, m_dwTimeElapsed, m_iDataSize, usSequence, GetLastICMPHeader()->ucICMPType==ICMP_Time); } } //Done return TRUE; } ERROR_HANDLER_RETURN("OnSocketReceive",TRUE)
![]() |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |