简体   繁体   中英

Icmp monitoring using visual c# .net

I want to write an application that monitors some of my remote branches. I want to monitor 2 things

1) icmp drop (if i send 10 pings and 2 or more are dropped then alert) 2) if latency of ping is above 20 ms then alert.

I have just defined the rough thresholds. Can it be done in visual c#, Basically i am learning c# and also doing stuff for my office so that my learning is in right direction. If you guys can point me in right direction i will be grateful. I have seen ping class in .net (on google i mean) but i think it only tells whether the IP is up or not.

Kindly guide me

This is a fairly easy thing to do.

First you need the winpcap driver http://www.winpcap.org/ which you may already have if you have anything like wireshark installed.

Once you have the winpcap driver you then either need 'SharpPcap' the .NET library to interface to WinPcap:

http://www.tamirgal.com/blog/page/SharpPcap.aspx

or you can wrap it yourself using P/Invoke and other unmanaged goodies...

http://dranaxum.wordpress.com/2010/11/20/using-winpcap-in-c/
http://geekswithblogs.net/dotnetnomad/archive/2008/01/31/119140.aspx

You could try the code in this project. http://www.codeproject.com/KB/dotnet/CSharpPing.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM