1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

regarind internet

Discussion in 'C' started by cnu_sree, Dec 11, 2006.

  1. cnu_sree

    cnu_sree New Member

    Joined:
    Dec 11, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     

Share This Page