Continuous SendAsync Ping in VB.Net
Posted on 2009-02-24
I have 4 servers that I need to ping. I can easily ping them all once with .SendAsync pinging method. Works great! I get my response back nicely from the PingCompleted Event.
1. I have setup 4 Ping Objects, one for each server
2. Each has it's own PingComplete handler to update screen reporting
3. I execute the Server1.SendAsync(address, address) for each (Server1-Server4 respectively)
How can I have their pings repeat once a second till I send a Server1.SendAsyncCancel? This will be a separate button on the screen labelled 'STOP' I will send a .SendAsyncCancel for each Ping object. Server1 - Server4 respectively again.
I tried placing an additional Server1.SendAsync(address, address) statement at the end of the PingComplete event to execute another ping and the pings are cruising at warp speed. I definitely don't want to add a system.thread sleep statment anywhere in there. That will pause the whole app. The .SendAsyncCancel sometimes get's ignored it's going so fast.
Does anyone have a good VB.Net example of pinging multiple address multiple times? And reporting on the reply for each. (return time, ip address, etc...)