| CICMPSocket:: SendTimestamp() |

Public Function | Declared in: ICMPSocket.h

## Declaration

    BOOL SendTimestamp(
        LPCSTR lpDestinationAddress,
        BOOL bReply,
        unsigned short usIdentifier,
        unsigned short usSequence,
        unsigned long ulOriginateTimestamp,
        unsigned long ulReceiveTimestamp,
        unsigned long ulTransmitTimestamp);

## Function Body

    try
    {
        LPICMPHeader lpHead;
        lpHead=ConstructICMP();

        if (!lpHead)
        {
            ReportError("SendTimestamp","Failed to construct ICMP header!");
            return FALSE;
        }

        //Check if echo or reply
        if (bReply)
            lpHead->ICMPType=ICMP_Timestamp_Reply;
        else
            lpHead->ICMPType=ICMP_Timestamp;

        lpHead->ICMPCode=0;
        lpHead->sICMP.sUS.us1=htons(usIdentifier);
        lpHead->sICMP.sUS.us2=htons(usSequence);
        lpHead->ICMP_Originate_Timestamp=htonl(ulOriginateTimestamp);
        lpHead->ICMP_Receive_Timestamp=htonl(ulReceiveTimestamp);
        lpHead->ICMP_Transmit_Timestamp=htonl(ulTransmitTimestamp);

        //And the checksum
        lpHead->ICMPChecksum=CalculateChecksum((unsigned short*)lpHead,ICMPHeaderLength);

        //Send it
        BOOL bSend;
        bSend=SendICMP(lpHead,lpDestinationAddress);

        //Clear up
        delete lpHead;

        return bSend;
    }
    ERROR_HANDLER_RETURN("SendTimestamp",FALSE)

## See Also

Class Overview | CSpoofSocket | Hierarchy Chart

This web site was generated using Surveyor V4.50.811.1. Click here for more information. | Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.