CloseIcmpSocket
Connect
DisplayError
GetIPAddress
IcmpChecksum
OpenNewSocket
Ping
Receive
SetAsynchNotification
SetTTL
BOOL OpenNewSocket
(HWND hWnd,
unsigned int NotificationMessage,
long NotifyEvents,
int AFamily,
int AType,
int AProtocol)
hWnd is a handle (GetSafeHwnd) to the window containing the message processor which will process the asynchronous socket events, NotificationMessage is the user-defined message number to associate with socket events, and NotifyEvents is the mask giving the events to process.
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns TRUE if successful, else FALSE.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
BOOL Connect
(LPINT ReceiveTimeout,
LPINT SendTimeout)
BOOL Connect
(LPINT ReceiveTimeout,
LPINT SendTimeout,
int AFamily,
int AType,
int AProtocol)
ReceiveTimeout and SendTimeout specifies the receive and transmit timeouts.
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns TRUE if successful, else FALSE.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
int CloseIcmpSocket(void)
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
int SetAsynchNotification
(HWND hWnd,
unsigned int Message,
long Events)
Message is the message number to send to the window, and Events is the event mask to notify on.
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
int SetTTL (int TTL)
Since each gateway encountered along the trip to the specified host decrements the TTL value by 1, TTL specifies the number of hops (gateways) to query before a response is returned. By incrementing the TTL from 1 to (number of hops to final destination), a TraceRoute function can be performed. In order to reach a designated host, TTL must be at least the number of gateways encountered on the way to the host, plus 1 (for the host itself).
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
int Ping (LPSTR pIcmpBuffer, int IcmpBufferSize)
The CIcmp variable icmpPingSentAt is set to the time value at the time the ping message is sent.
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
unsigned short IcmpChecksum (unsigned short FAR *lpBuf, int Len)
Returns an unsigned integer value of the computed checksum.
unsigned long GetIPAddress (LPSTR iHostName)
Sets iHostName to the value of the host name returned in icmpHostEnt.
Requires the message number to send to the window, and the events to notify on.
Sets CIcmp variable icmpSockAddr fields appropriately, leaving the IP address in icmpSockAddr.sin_addr, and the type of address in icmpSockAddr.sin_family. Also sets icmpHostEnt fields appropriately
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
int Receive (LPSTR pIcmpBuffer, int IcmpBufferSize)
pIcmpBuffer is the address of the buffer to store the incoming message and IcmpBufferSize is the integer buffer size. The buffer must be large enough to contain the incoming message. In the case of an ICMP Echo Reply, the size would be the size of the outgoing message plus the size of an ICMP header plus the size of an IP header.
Sets icmpRcvLen to the length of the message received, icmpPingReceivedAt to the time the receive command is issued, icmpRoundTripTime to the difference between icmpPingSentAt and icmpPingReceivedAt, icmpCurSeq to the incoming sequence number and icmpCurId to the incoming id field.
Sets rcvSockAddr fields appropriately.
Sets icmpSocketError and icmpSocketErrorMod to indicate the type of error, and returns the integer result of the operation.
icmpSocketError and icmpSocketErrorMod are preserved until the next operation on this CIcmp object is performed.
void DisplayError (CString ErrorType, CString FunctionName)
Sets the message box title to FunctionName.
The message is displayed in a modal box, requiring an OK response before the thread containing this method can progress.