Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

How to PING Server in C#

, 13 Sep 2010
Rate this:
Please Sign up or sign in to vote.
using System;using System.Runtime;using System.Runtime.InteropServices;public static class InternetConnectionStatus{ [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState(out int Description, int Reserved); public static bool Connected() { ...
using System;
using System.Runtime;
using System.Runtime.InteropServices;
public static class InternetConnectionStatus
{
    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState(out int Description, int Reserved);
    public static bool Connected()
    {
        int Descript;
        return InternetGetConnectedState(out Descript, 0);
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ron Beyer
President 6D Systems LLC
United States United States
I studied Software Engineering at Milwaukee School of Engineering for 2 years before switching to Management of Information Systems for a more business oriented approach. I've been developing software since the age of 14, and have waded through languages such as QBasic, TrueBasic, C, C++, Java, VB6, VB.NET, C#, etc. I've been developing professionally since 2002 in .NET.

Comments and Discussions

 
QuestionGreat tip PinprofessionalMarco Bertschi22-Jan-14 20:35 
AnswerRe: Great tip PinmvpRon Beyer23-Jan-14 2:41 
GeneralRe: Great tip PinprofessionalMarco Bertschi23-Jan-14 2:54 
GeneralRe: Great tip PinmvpRon Beyer23-Jan-14 2:57 
GeneralRe: Great tip PinprofessionalMarco Bertschi23-Jan-14 3:00 
GeneralThis will not help if you are working inside of a company wi... PinmemberSteve Maier14-Sep-10 5:04 
GeneralGood alternate for Ping. PinmemberAbhishek Sur13-Sep-10 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 13 Sep 2010
Article Copyright 2010 by Ron Beyer
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid