自动测试网络接口
我正在开发一个软件组件,负责测试网络接口是否与互联网连接。可以将其视为 XBOX360 所做的相同测试,以通知用户是否已连接到 Live 网络(仅作为示例)。
到目前为止,我认为自动测试将按如下方式运行:
1)测试物理网络接口(电缆是否已连接,是否有上行/下行链路等...)
2)测试逻辑网络(有IP地址,有DNS等...)
3)连接到互联网(例如可以访问谷歌)
4) ???
5)利润! (开玩笑……)
我的问题与步骤 3 有关:如何正确检测我的软件是否已与互联网连接?有没有固定的IP地址可以ping?
问题是我不想仅仅依赖 google.com(或任何其他众所周知的地址),因为这些地址可能会及时更改,并且我的组件将嵌入移动设备上,不容易更新。
有什么建议吗?
I'm developing a software component responsible for testing if a network interface has conectivity with the internet. Think of it as the same test the XBOX360 does to inform the user if it's connected with the Live network (just as an example).
So far I figured the autotest would run as this:
1) Test the physical network interface (if the cable is conected, has up/downlink, etc...)
2) Test the logical network (has IP address, has DNS, etc...)
3) Connects to the internet (can access google, for example)
4) ???
5) Profit! (just kidding...)
My question relates to step 3: How can I detect, correctly, if my software has connection with the internet ? Is there any fixed IP address to ping ?
The problem is that I don't want to rely solely on google.com (or any other well-known address), as those can change in time, and my component will be embbeded on a mobile device, not easy to update.
Any suggestions ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议 icann.org
另一个问题是您是否确实想检查您是否与负责提供互联网连接的提供商有联系。如果是这种情况,即使 ISP 关闭,您的测试也应该是绿色的。
I suggest icann.org
Another question is if you really want to check if you have connection with the provider responsible to deliver internet connection. If that's the case you're test should be green even if the ISP is down.