C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Code for pinging the target System Posted by Venkataraghav on 23 Jan 2006 at 3:32 AM
Hi All,

I am Venkat, this is my first post to the group and I really looking forward the help from you people. I just wanted the C# code for continuously pinging the target system or if it is not possible to ping the target system continuously atleast the code in C# for pinging the target system.

Thanking you in Advance,
Venkat.
Report
Re: Code for pinging the target System Posted by weicco on 23 Jan 2006 at 4:00 AM
: I just wanted the C# code for continuously pinging the target system or if it is not possible to ping the target system continuously atleast the code in C# for pinging the target system.

Easiest way would to call ping.exe like this (didn't test it):

while (true)
{
    System.Diagnostics.Process proc =
        System.Diagnostics.Process.Start("ping.exe", "-n 1 www.domain.tld");
    proc.WaitForExit();
    if (proc.ExitCode != 0)
    {
        throw new Exception("Destination host unreachable");
    }
}





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.