check your internet connection with c#
by simohamed attahri
用c#检测你的网络连接
how to check if your computer is connected to the internet with c#. it's much more easier that other tutorials i've seen in other sites. in deed, we're going to use a simple api function internetgetconnectedstate, to return a boolean variable.
怎么用c#来检测你的计算机是否连接到互联网呢?这可能是我见过最简单的教程了。其实我们就是使用一个简单的internetgetconnectedstate api函数,结果是返回一个boolean类型的变量。
this function takes two arguments :
这个函数有两个参数:
the first one is an integer used with out keyword, that means that after calling the function, the variable will contain an interger that describes the connection state ( use of a modem, use of a proxy, offline mode...). note that you must refer to www.msdn.com for more information about that.