16

检查是否连接到互联网?求一个优雅的思路

 4 years ago
source link: https://www.v2ex.com/t/656983
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Linux - @black11black - 如题,业务需要程序自检是否能连接到互联网,如果断网需要立即做出反应,要求是反应足够快。一个简单的想法是每秒访问指定网站,来检测连通性,这样可以规避一些“假连通”的情况,但是稳定提供服务的网站很

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK