如何查看网络连接是否更改状态? [英] How can I see if a network connection changes state?

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

问题描述

我正在编写一个应用程序,用于检查计算机是否连接到一个特定的网络,并为我们的用户做一些魔术。

I am writing an application that checks if the computer is connected to one particular network or not, and does some magic for our users.

该应用程序将在后台,并检查用户是否要求它(菜单中的菜单)。我还希望该应用程序能够自动检查用户是否从有线变为无线,或者断开连接并连接到新网络,从而产生神奇效果。

The application will run in the background and perform the check if the user requests it (menu in tray). I also want the application to automatically check and do magic if the user changes from wired to wireless, or disconnects and connects to a new network.

是否有可能做到这一点

推荐答案

您应该尝试 System.Net.NetworkInformation 命名空间,或使用< a href = https://stackoverflow.com/questions/843810/c-fastest-way-to-test-internet-connection> P /调用。

示例:

  • Internet Connection State Control
  • Determine if internet connection is available

这篇关于如何查看网络连接是否更改状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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