Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   regarind internet (http://www.go4expert.com/forums/regarind-internet-t2197/)

cnu_sree 11Dec2006 11:00

regarind internet
 
how we can find whether net is enabled or disabled using c.
iam doing the coding in unix.
i tried using this:
if(system("ping -c 1 -w 1 yahoo.com > /dev/null 2> /dev/null") != 0)
fprintf(stderr,"Net is down!\n");
else
fprintf(stderr,"Net is up\n");

but i want to do this without using ping to websites.
so someone suggested be ping ur own gateway or use raw sockets
no knowledge on that.
so please tell me how we can do this
thank u
inadvance
sreee


All times are GMT +5.5. The time now is 23:18.