I have used the IcmpSendEcho2 command successfully synchronously.
A question I have is what would the signature look like for the ApcRoutine
callback routine I need to define?
When I call IcmpSendEcho2 what would the third parameter look like?
I will need to send many IcmpSendEcho2 requests at one time. How will the
callback ApcRoutine know which IcmpSendEcho2 call is done. I guess this is
where the ApcContext parameter comes into play?
I can't find any example code on MSDN or elsewhere that demonstrates how to
use the IcmpSendEcho2 command asynchronously.
----------------
int ReplyCame(PVOID param)
{
char* szAddr = (char*) param;
printf("Replay Came for %s......\n", szAddr);
return 0;
}
char* szAddr1 = "172.18.1.1";
char* szAddr2 = "172.18.1.4";
int _tmain(int argc, _TCHAR* argv[])
{
char *SendData = "Data Buffer";
LPVOID ReplyBuffer;
HANDLE IcmpHandle = IcmpCreateFile();
IPAddr addr1 = inet_addr(szAddr1);
IPAddr addr2 = inet_addr(szAddr2);
ReplyBuffer = (VOID*) malloc(sizeof(ICMP_ECHO_REPLY) + sizeof(SendData));
IcmpSendEcho2(IcmpHandle, NULL, (FARPROC)ReplyCame, szAddr1, addr1,
SendData, sizeof(SendData), NULL, ReplyBuffer, 8*sizeof(ReplyBuffer) +
sizeof(ICMP_ECHO_REPLY), 1000);
IcmpSendEcho2(IcmpHandle, NULL, (FARPROC)ReplyCame, szAddr2, addr2,
SendData, sizeof(SendData), NULL, ReplyBuffer, 8*sizeof(ReplyBuffer) +
sizeof(ICMP_ECHO_REPLY), 1000);
SleepEx(5000, TRUE);
return 0;
}
----------------
--
Farooque Khan
Project Manager
Infospectrum India Pvt. Ltd.
faro...@info-spectrum.com
Phone: +91 712 229 3711
www.info-spectrum.com
This e-mail may contain confidential or proprietary information. If you are
not the intended recipient please notify the author by replying to this
e-mail and please note that use, disclosure, distribution, copying or
printing of this e-mail or its attachments is strictly prohibited and may be
unlawful. Whilst this e-mail has been checked for viruses, the sender takes
no responsibility and recipients are advised to undertake their own checks.
"Jim464" <Jim...@discussions.microsoft.com> wrote in message
news:BEBBB74B-E3E5-4D09...@microsoft.com...
A follow up question:
In the ReplayCame function I will need to call IcmpParseReplies to get the
result
of the IcmpSendEcho2 command. For the call to IcmpParseReplies I need to
pass in the ReplyBuffer. So the way I understand it, I would need to have
seperate RelayBuffers for each call to IcmpSendEcho2 The way your code is
written now, I would get two calls to RelayCame, but I could not check the
result of the IcmpSendEcho2 command because it is using the same buffer for
each call to IcmpSendEcho2. Is that correct ?
HTH,
--
Farooque Khan
Project Manager
Infospectrum India Pvt. Ltd.
faro...@info-spectrum.com
Phone: +91 712 229 3711
www.info-spectrum.com
This e-mail may contain confidential or proprietary information. If you are
not the intended recipient please notify the author by replying to this
e-mail and please note that use, disclosure, distribution, copying or
printing of this e-mail or its attachments is strictly prohibited and may be
unlawful. Whilst this e-mail has been checked for viruses, the sender takes
no responsibility and recipients are advised to undertake their own checks.
"Jim464" <Jim...@discussions.microsoft.com> wrote in message
news:6D645196-415F-491B...@microsoft.com...
need urgent help
If you have differences with invoking function exported from UNmanaged dll,
you probably has to ask this question somewhere at VB .NET newsgroup.
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
<prashant wanjari> wrote in message
news:20084102414pr...@yahoo.com...