Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using "ping" inside of C#

Posted on 2005-04-10
2
Medium Priority
?
287 Views
Last Modified: 2008-03-10
Hi,

I need my program to be able to determine if the web connection is still active.  Does anybody have the source code handy that I need, in order to do this?


Thanks,
Bob
0
Comment
Question by:ba272
2 Comments
 
LVL 2

Accepted Solution

by:
WebSpecials earned 2000 total points
ID: 13748729
private void Ping(string hostname)
{
    //Create ping object
    Ping netMon = new Ping();
I think that is what you need

    //Ping host (this will block until complete)
    PingResponse response = netMon.PingHost(hostname, 4);

    //Process ping response
    if (response != null)
    {
        ProcessResponse(response);
    }
}
(cite: CodeProject)

For more Information:
http://www.codeproject.com/useritems/CSharpPing.asp
0
 

Author Comment

by:ba272
ID: 13748820
Thanks a lot.  I'm having a little difficulty getting this to compile, but its just what I needed.

Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question