Click here to Skip to main content
12,352,739 members (64,040 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

9.6K views
2 bookmarked
Posted

How to PING Server in C#

, 13 Sep 2010 CPOL
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)

Share

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.

You may also be interested in...

Comments and Discussions

 
QuestionGreat tip Pin
Marco Bertschi22-Jan-14 20:35
professionalMarco Bertschi22-Jan-14 20:35 
AnswerRe: Great tip Pin
Ron Beyer23-Jan-14 2:41
mvpRon Beyer23-Jan-14 2:41 
GeneralRe: Great tip Pin
Marco Bertschi23-Jan-14 2:54
professionalMarco Bertschi23-Jan-14 2:54 
GeneralRe: Great tip Pin
Ron Beyer23-Jan-14 2:57
mvpRon Beyer23-Jan-14 2:57 
GeneralRe: Great tip Pin
Marco Bertschi23-Jan-14 3:00
professionalMarco Bertschi23-Jan-14 3:00 
GeneralThis will not help if you are working inside of a company wi... Pin
Steve Maier14-Sep-10 5:04
memberSteve Maier14-Sep-10 5:04 
GeneralGood alternate for Ping. Pin
Abhishek Sur13-Sep-10 12:14
memberAbhishek Sur13-Sep-10 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 13 Sep 2010
Article Copyright 2010 by Ron Beyer
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid