本文介绍了在Windows CE中使用C#代码进行Internet检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨我需要了解我的拨号连接是连接还是未连接。 我使用过这个dll和代码,但有时它不能正确回答: 任何其他解决方案将不胜感激,tnx [DllImport( wininet.dll)] private extern static bool InternetGetConnectedState( out int 描述, int ReservedValue); public static bool IsConnected() { try { int ConnDesc; return InternetGetConnectedState( out ConnDesc, 0 ); } catch { return 假; } } 解决方案 尝试Ping到远程网络服务器,即google.com和收集回复... http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx [ ^ ] 使用 OpenNETCF.Net.NetworkInformation; bool result = false ; Ping ping = new Ping(); PingReply pingReply = ping.Send( www.google.com ); if (pingReply.Status == IPStatus.Success) result = true ; HiI need to understand whether my dial-up connection is connected or is not connected.I have used this dll and code, but sometimes it doesn't give me correct answer:any other solutions will be appreciated, tnx[DllImport("wininet.dll")] private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);public static bool IsConnected() { try { int ConnDesc; return InternetGetConnectedState(out ConnDesc, 0); } catch { return false; } } 解决方案 Try Pinging to a remote webserver ie, google.com and collect the reply...http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx[^]using OpenNETCF.Net.NetworkInformation; bool result = false; Ping ping = new Ping(); PingReply pingReply = ping.Send("www.google.com"); if (pingReply.Status == IPStatus.Success) result = true; 这篇关于在Windows CE中使用C#代码进行Internet检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 19:27