Has anybody ever seen this happen? Any thoughts on what I might be
doing wrong?
Thanks,
Curt
BTW, here's how I'm calling IcmpSendEcho:
********************
#define PING_BUFFER_SIZE 8192
#define DEFAULT_ECHO_DATA_LENGTH 32
...
BYTE aPingSendBuffer [ PING_BUFFER_SIZE
] ;
BYTE aPingReplyBuffer [
PING_BUFFER_SIZE ] ;
HANDLE hICMP ;
...
dwReplyCount = IcmpSendEcho ( hICMP,
nDestination,
aPingSendBuffer,
DEFAULT_ECHO_DATA_LENGTH,
NULL,
aPingReplyBuffer,
PING_BUFFER_SIZE,
pPingInfo->dwTimeout * 1000 ) ;
********************
Paul T.
"Curtis Coleman" <Curtis....@viasat.com> wrote in message
news:42464606.0208...@posting.google.com...
BOOL CEnetComm::Ping(DWORD ipaddress)
{
char acPingBuffer[64];
BOOL retVal = FALSE;
char pIpe[1024];
DWORD dwStatus;
HANDLE hIP = IcmpCreateFile();
if (hIP == INVALID_HANDLE_VALUE)
{
AfxMessageBox(_T("Unable to open ping service."));
retVal = FALSE;
}
else
{
// Build ping packet
memset(acPingBuffer, '\xAA', sizeof(acPingBuffer));
dwStatus = IcmpSendEcho(hIP, htonl(ipaddress),
acPingBuffer, sizeof(acPingBuffer), NULL, pIpe,
1024, 2000); // hard coded timeout of 2 seconds
if ( dwStatus == 0 )
retVal = FALSE; // failure
else
retVal = TRUE; // success
IcmpCloseHandle(hIP);
}
return retVal;
}
Hope this helps.
Chris