简体   繁体   中英

Check internet connection or check internet connection constantly

How can i check internet connection in c++ or c, i'm using mac & cant find a good way. If

possible i want to check internet connection constantly' so i can save the users data.

Please provide me with examples, information and ideas.

THanks!

Call system("ping www.google.com").

If the process dies or becomes slow, then your internet connection is doing badly.

You can try implementing a lightweight ICMP to ping a remote host periodically.

Maybe this question can shed some light: Mac network ping source code compile error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM