-
Apr 3rd, 2013, 02:04 PM
#1
Thread Starter
Lively Member
Multiple PINGs in parallel
Hello!
I have a ping function like s = Ping("1.2.3.4", 10000) that returns whether a host is alive or not.
10000=timeout value in miliseconds
The ping function uses IcmpSendEcho API function.
I want to be able to do multiple pings in parallel, even in case the host is not answering ( during the timeout period ).
I googled and tried using CreateThread API, but it crashes.
Any idea on how to call my ping function asynchronous or other workaround?
-
Apr 3rd, 2013, 02:41 PM
#2
Re: Multiple PINGs in parallel
Originally Posted by sorinn
I want to be able to do multiple pings in parallel, even in case the host is not answering ( during the timeout period ).
Why exactly do you need to do that?
Originally Posted by sorinn
I googled and tried using CreateThread API, but it crashes.
Any idea on how to call my ping function asynchronous or other workaround?
Creating additional threads won't be necessary. The remarks in IcmpSendEcho's documentation states:
Originally Posted by MSDN
The IcmpSendEcho2 and IcmpSendEcho2Ex functions are enhanced version of IcmpSendEcho that support asynchronous operation. The IcmpSendEcho2Ex function also allows the source IP address to be specified. This feature is useful on computers with multiple network interfaces.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 3rd, 2013, 02:50 PM
#3
Thread Starter
Lively Member
Re: Multiple PINGs in parallel
It is a project I'm working on that shall monitor some IPs at the same time and send an alert if any IP or more IPs are down.
I don't know how to use IcmpSendEcho2. I guess it is the API that supports IPv6.
If I keep the same params and I call IcmpSendEcho2, it crashes
-
Apr 3rd, 2013, 03:02 PM
#4
Re: Multiple PINGs in parallel
Originally Posted by sorinn
I don't know how to use IcmpSendEcho2. I guess it is the API that supports IPv6.
No, there are separate APIs for that. This is from the IcmpSendEcho function:
Originally Posted by MSDN
Originally Posted by sorinn
If I keep the same params and I call IcmpSendEcho2, it crashes
See the previously given documentation link. It contains detailed information about the IcmpSendEcho2 function and instructions on how to pass each parameter.
Last edited by Bonnie West; Apr 3rd, 2013 at 03:06 PM.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 3rd, 2013, 03:09 PM
#5
Re: Multiple PINGs in parallel
One problem with this thread is that the result is all too easily exploited for nefarious purposes such as port scanning. That could make it a prohibited topic and a thread likely to be locked as violating posting guidelines here.
Of course anyone with any sense has pings disabled anyway, if only at their Internet gateway router.
Within a LAN there are more reliable ways to detect whether machines are up anyway. But all of this falls into the realm of administrative activities and not VB6 development at all. VB6 is not an admin tool.
-
Apr 3rd, 2013, 03:37 PM
#6
Thread Starter
Lively Member
Re: Multiple PINGs in parallel
Hello Dilettante!
My project is to monitor some critical IPs in the organization, IPs given in a file list and send alert via e-mail if smth occurs.
The computer where this VB6 app will run will have redundant Internet connection using NIC Teaming.
"Within a LAN there are more reliable ways to detect whether machines are up anyway"...Any effective way to achive my goal with other tools?
-
Apr 3rd, 2013, 03:44 PM
#7
Re: Multiple PINGs in parallel
Originally Posted by dilettante
One problem with this thread is that the result is all too easily exploited for nefarious purposes such as port scanning. That could make it a prohibited topic and a thread likely to be locked as violating posting guidelines here.
Of course anyone with any sense has pings disabled anyway, if only at their Internet gateway router.
You can't really use the ICMP protocol for port scanning since it doesn't use ports. You can abuse the ICMP protocol by sending large packages of information and by doing so could create a DOS attack, that's why many turn it off on the server. But on the other hand you can abuse the TCP or UDP protocols as well but we have always allowed questions about how to use these.
Originally Posted by dilettante
But all of this falls into the realm of administrative activities and not VB6 development at all. VB6 is not an admin tool.
That's true but no programming language are really admin tools (unless you count things like PowerShell scripts a programming language) yet all software admin tools are built using one programming language or another.
This thread has been reported, and as always we thank our members for their help on keeping this forum clean, however in this case I will allow it.
-
Apr 3rd, 2013, 03:54 PM
#8
Re: Multiple PINGs in parallel
You're correct, "port scanning" was the wrong phrase.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|