logo
VitNX3 Documentation

# Internet.IsHaveInternet Method

Namespace: VitNX3.Functions.Information
Assembly: VitNX3 (in VitNX3.dll)
Are the have internet.
VB
C#
F#
C++
JScript
Copy

    public static INTERNET_STATUS IsHaveInternet(
       string ipAddressOrDomainForPing = "google.com"
    )

    This language is not supported or no code example is available.

#### Parameters

ipAddressOrDomainForPing
  string

The ip address or domain for ping.

#### Return Value

INTERNET_STATUS

An INTERNET_STATUS.

Source code
VB
C#
F#
C++
JScript
Copy

    public static INTERNET_STATUS IsHaveInternet(string ipAddressOrDomainForPing = "google.com")
     {
         try
         {
             Ping ping = new Ping();
             PingReply pingReply = null;
             pingReply = ping.Send(ipAddressOrDomainForPing);
             if (pingReply.Status == IPStatus.Success)
                 return INTERNET_STATUS.CONNECTED;
             else
                 return INTERNET_STATUS.UNCONNECTED;
         }
         catch { return INTERNET_STATUS.UNKNOWN_PROBLEM; }
     }

    This language is not supported or no code example is available.

Applies to

#### .NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

#### .NET Core

Supported in: 5.0+, 6.0+
See Also
Internet Class
VitNX3.Functions.Information Namespace