how can i check if the internet connection is established using C programming language ???
i know one way to do it using system ping
function. this method is simple:
system("ping -c1 > ping.tmp");
and after one PING i can check file with some text returning by ping command and using simple compare: if the file ping.tmp
is empty connection isn't established but if file contains some text i can "guess" that connection works correctly...
but it isn't good way to check internet connection.
using PHP and fopen
function i could open network file (for example: some_site.com/index.php) and if connection is correct (and network file exists) function return true...
what should i do to simple check connection using C programming language ??