We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[5346] Checking Internet Availability using C#

Last post 03-01-2008 9:44 PM by godaemad. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [5346] Checking Internet Availability using C#

    This thread is for discussions of Checking Internet Availability using C#.

    • Post Points: 10
  • 11-18-2006 6:34 AM In reply to

    Re: [5346] Checking Internet Availability using C#

    Would it be possible to see a completed code example Smiley Face [:)].

     

    • Post Points: 10
  • 03-01-2008 9:44 PM In reply to

    • godaemad
    • Not Ranked
    • Joined on 03-01-2008
    • Egypt
    • New Member
    • Points 5

    Re: [5346] Checking Internet Availability using C#

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.Runtime.InteropServices;

     

     

     

     

    [
    Flags] enum ConnectionState: int{ INTERNET_CONNECTION_MODEM = 0x1, INTERNET_CONNECTION_LAN = 0x2, INTERNET_CONNECTION_PROXY = 0x4, INTERNET_RAS_INSTALLED = 0x10, INTERNET_CONNECTION_OFFLINE = 0x20, INTERNET_CONNECTION_CONFIGURED = 0x40}

     

    namespace ConsoleApplication1

    {

     

    class Program

    {

    [
    DllImport("wininet.dll", CharSet = CharSet.Auto)]

    static extern bool InternetGetConnectedState(ref ConnectionState lpdwFlags, int dwReserved);

    static void Main(string[] args)

    {

     

    ConnectionState Description = 0;

    Console.WriteLine(InternetGetConnectedState(ref Description, 0).ToString());

    Console.ReadLine();

    }

    }

    }

    • Post Points: 5
Page 1 of 1 (3 items)