局域网连接已启动或断开
Lan connection is up or down
在
c++ 或 c# 的 wince 7 中,找出 LAN 连接是打开还是关闭的方法是什么?
您可以从 c# 或 c++ 应用程序中使用 ipConfig 命令行工具,它提供所有网络适配器的状态。
此问题可能很有用:在 C# 中检查网络状态
bool networkUp = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
试试这个:
try
{
System.Net.IPHostEntry entry = System.Net.Dns.GetHostByName("hostname");
// found host
}
catch(System.Net.Socket.SocketException)
{
//host not found == LAN not connected!
}
可以在
.NET 中使用NetworkChange
类。对于 LAN 连接,请使用NetworkInterface.GetIsNetworkAvailable()
方法。
Return Value
Type: System.Boolean
true if a network connection is available; otherwise, false.
也看看那些;
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
相关文章:
- 如何创建一个空的全局类并在启动时实例化它
- 当套接字连接断开时检测C/C++Unix
- 即使我读取了所有内容,在FIFO上打开的QSocketNotifier也会一直启动
- 使用 std::string () const 函数启动线程或未来
- 如何修复valgrind启动时的致命错误(与libc6-dbg和libc6-dbg:i386连接)
- 将向量作为类>(值)<向量启动和向量<类>[值]有什么区别
- 如何创建线程序列以按照启动顺序执行任务?
- WINAPI 注册应用程序重新启动时不清除打开的套接字
- 升压信号2将插槽传递到成员功能以断开连接
- 在挂钩启动新线程时解除挂钩进程
- 程序无法启动,因为缺少 libmpc-3.dll
- 从 exe 文件 (Visual Studio ) 启动时调试断言失败
- QSerialPort 在应用程序启动之前正在使用中
- 无法在 Arch Linux 中启动虚幻引擎 4
- C++关于指针和使用函数将它们启动到堆的行为究竟是什么?
- 如何使用 ctypes 停止和重新启动从 Python 运行的C++代码
- 程序在使用 system() 启动另一个可执行文件时停止
- Qt 和 Android - 如何使用 Qandroidjniobject 启动相机
- Q没有管理权限的 exe 无法启动维护工具
- 局域网连接已启动或断开