Méthode | Description | |
---|---|---|
Check ( Method method, string address, int port ) : bool | ||
Check ( Method method = DefaultMethod, string host = DefaultHost, string ipv4 = DefaultIpAddress, int port = DefaultPort, int timeout = DefaultTimeout ) : bool |
Checks whether there is an internet connection. Defaults to calling the IsConnectionAvailable method.
|
|
DnsTest ( string url = DefaultHost ) : bool |
|
|
IsConnectionAvailable ( ) : bool |
Check if a connection to the Internet can be established. Much faster than the other methods, as it does not require a DNS lookup.
|
|
PingTest ( string address = DefaultIpAddress, int timeout = DefaultTimeout ) : bool |
Ping an IP address. There can be some delay in response of web request, therefore this method may not be fast enough for some applications. A better way is to check whether port 80, default port for http traffic, of an always online website. You cannot use this method in .NET Compact Framework because there is no System.Net.NetworkInformation namespace that comes with Compact Framework. However, you can use Smart Device Framework ("http://www.opennetcf.com", Community Edition is free for download) provided by OpenNETCF. This framework comes with many other useful tools that .NET Compact Framework does not contain. Notice that I used Google’s IP address 208.69.34.231. We could use Google’s web address www.google.com: |
|
TcpSocketTest ( string address = DefaultHost, int port = DefaultPort ) : bool |
There can be some delay in response of web request therefore this method may not be fast enough for some applications. A better way is to check whether port 80, default port for HTTP traffic, of an always online website.
|
|
WebRequestTest ( string address = DefaultHost ) : bool |
We may send a web request to a website which assumed to be online always, for example google.com. If we can get a response, then obviously the device that runs our application is connected to the internet.
|
Méthode | Description | |
---|---|---|
InternetGetConnectedState ( int &connDescription, int reservedValue ) : bool |
public static Check ( Method method, string address, int port ) : bool | ||
method | Method | |
address | string | |
port | int | |
Résultat | bool |
public static Check ( Method method = DefaultMethod, string host = DefaultHost, string ipv4 = DefaultIpAddress, int port = DefaultPort, int timeout = DefaultTimeout ) : bool | ||
method | Method | |
host | string | |
ipv4 | string | |
port | int | |
timeout | int | |
Résultat | bool |
public static DnsTest ( string url = DefaultHost ) : bool | ||
url | string | |
Résultat | bool |
public static IsConnectionAvailable ( ) : bool | ||
Résultat | bool |
public static PingTest ( string address = DefaultIpAddress, int timeout = DefaultTimeout ) : bool | ||
address | string | |
timeout | int | |
Résultat | bool |
public static TcpSocketTest ( string address = DefaultHost, int port = DefaultPort ) : bool | ||
address | string | The address to try to connect to. Defaults to |
port | int | The port to use. Defaults to |
Résultat | bool |
public static WebRequestTest ( string address = DefaultHost ) : bool | ||
address | string | The address to try to connect to. Defaults to Google. |
Résultat | bool |