网络连接 [英] Network Connection

查看:79
本文介绍了网络连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用我的程序检测互联网连接。

当我连接时它返回true,但即使我'断开它

返回true

我不知道为什么?

Thx

Omar Abid

Hi,
I''m using my with a program to detect an internet connection.
It return true when I''m connected, but even when I ''m disconnected it
returns true
I don''t know why ?
Thx
Omar Abid

推荐答案

Omar Abid写道:
Omar Abid wrote:



我正在使用我的程序来检测互联网连接。

当我连接时它返回true,但即使我已经断开它

返回true

我不知道为什么?

Thx

Omar Abid
Hi,
I''m using my with a program to detect an internet connection.
It return true when I''m connected, but even when I ''m disconnected it
returns true
I don''t know why ?
Thx
Omar Abid



你用什么命令?

What command are you using?


12月12日13:43,Chris Diver< chris.di ... @ hotmail。 co.ukwrote:
On 12 juin, 13:43, Chris Diver <chris.di...@hotmail.co.ukwrote:

Omar Abid写道:
Omar Abid wrote:



我正在使用我的程序来de连接互联网。

当我连接时它返回true,但即使我断开它

返回true

我不知道为什么?

Thx

Omar Abid
Hi,
I''m using my with a program to detect an internet connection.
It return true when I''m connected, but even when I ''m disconnected it
returns true
I don''t know why ?
Thx
Omar Abid



你用什么命令?


What command are you using?



my.network

my.network


Omar Abid写道:
Omar Abid wrote:

12月13日,13:43,Chris Diver< chris.di ... @ hotmail.co.ukwrote:
On 12 juin, 13:43, Chris Diver <chris.di...@hotmail.co.ukwrote:

> ; Omar Abid写道:
>Omar Abid wrote:

>>
我正在使用我的程序来检测互联网连接。
当我连接时它返回true,但即使我断开连接它也会返回true
我不知道为什么?
Thx
Omar Abid
>>Hi,
I''m using my with a program to detect an internet connection.
It return true when I''m connected, but even when I ''m disconnected it
returns true
I don''t know why ?
Thx
Omar Abid


你用的是什么命令?

What command are you using?



my.network


my.network



My.Computer.Network.IsAvailable对我来说很好,虽然我只是有

a单一连接到局域网。


您可以随时ping几个热门地址,看看你是否有一个

互联网连接。 EG www.google.com www.microsoft.com
www.yahoo.com 它们不太可能在同一时间关闭。


您可以在try / catch语句中发送webrequest,如果它会抛出一个

的例外,然后连接到互联网就会出现问题,而且你没有连接到



也没有一个活跃的互联网连接并不意味着你没有连接到网络。


HTH,

Chris

My.Computer.Network.IsAvailable works fine for me, although I just have
a single connection to a LAN.

You could always ping a few popular addresses to see if you have an
Internet connection. E.G www.google.com, www.microsoft.com,
www.yahoo.com its unlikely that they will all be down at the same time.

You could send a webrequest in a try/catch statement, if it throws an
exception then there is a problem connecting to the internet and you are
not connected.

Also not having an active Internet connection doesn''t mean that you are
not connected to a Network.

HTH,
Chris


这篇关于网络连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆