Application to check the Internet status??

Discussion in 'C Programming' started by Ravindra.B, Aug 5, 2008.

  1. Ravindra.B

    Ravindra.B Guest

    I tried checking internet status of my system by issuing ping to some
    well known server like google.com. But, the problem is that ping is
    not working if target address is not within the same network. I
    actually started writing small application, which can tell the
    internet status of the given system by using some standard network
    Apis. It would be great if some one suggest me how to proceed for
    this.

    Thanx in advance,
    Ravindra. Bhadramraju
     
    Ravindra.B, Aug 5, 2008
    #1
    1. Advertising

  2. Ravindra.B

    santosh Guest

    Ravindra.B wrote:

    > I tried checking internet status of my system by issuing ping to some
    > well known server like google.com. But, the problem is that ping is
    > not working if target address is not within the same network. I
    > actually started writing small application, which can tell the
    > internet status of the given system by using some standard network
    > Apis. It would be great if some one suggest me how to proceed for
    > this.


    Try on a group for your system since any methods to do this will be
    specific for your implementation and/or system. For ideas under Unix
    type systems see comp.unix.programmer and see
    comp.os.ms-windows.programmer.win32 for Windows machines. There is no
    generic way to do this, nor in purely Standard C.
     
    santosh, Aug 5, 2008
    #2
    1. Advertising

  3. Ravindra.B

    Richard Bos Guest

    "Ravindra.B" <> wrote:

    > I tried checking internet status of my system by issuing ping to some
    > well known server like google.com. But, the problem is that ping is
    > not working if target address is not within the same network.


    No, the problem is that there is no reliable way to do what you want.
    And no, I don't mean "no way using ISO C only"; I mean no reliable way
    at all. For example, have you thought about what you'd do if your
    firewall let you connect to most sites, but (for some, possibly
    temporary reason) not to the one you intend to abuse for this purpose?

    Richard
     
    Richard Bos, Aug 5, 2008
    #3
  4. On 5 Aug 2008 at 12:46, Ravindra.B wrote:
    > I tried checking internet status of my system by issuing ping to some
    > well known server like google.com. But, the problem is that ping is
    > not working if target address is not within the same network. I
    > actually started writing small application, which can tell the
    > internet status of the given system by using some standard network
    > Apis. It would be great if some one suggest me how to proceed for
    > this.


    I'm not completely sure what it is you want to do. It may just be a DNS
    problem - otherwise you could try a traceroute and see how far your
    packet gets before being dropped.

    As for doing this in C, I can't think of a standard ping library - you
    could download a ping program from the web and include the code in your
    program, or just write it yourself using basic networking: you need to
    send an ICMP echo request packet, and then receive (hopefully...) the
    echo back.

    If you need more information, describe the problem clearly!
     
    Antoninus Twink, Aug 5, 2008
    #4
  5. Ravindra.B

    Ravindra.B Guest

    Re: Application to check the Internet status??

    On Aug 6, 3:10 am, Antoninus Twink <> wrote:
    > On  5 Aug 2008 at 12:46, Ravindra.B wrote:
    >
    > > I tried checking internet status of my system by issuing ping to some
    > > well known server like google.com. But, the problem is that ping is
    > > not working if target address is not within the same network. I
    > > actually started writing small application, which can tell the
    > > internet status of the given system by using some standard network
    > > Apis. It would be great if some one suggest me how to proceed for
    > > this.

    >
    > I'm not completely sure what it is you want to do. It may just be a DNS
    > problem - otherwise you could try a traceroute and see how far your
    > packet gets before being dropped.
    >
    > As for doing this in C, I can't think of a standard ping library - you
    > could download a ping program from the web and include the code in your
    > program, or just write it yourself using basic networking: you need to
    > send an ICMP echo request packet, and then receive (hopefully...) the
    > echo back.
    >
    > If you need more information, describe the problem clearly!


    Well, the requirement is something like this...a small api/function
    which could tell if the internet connection is available or not and in
    either case it should send a userfriendly message to the application.
    To put it in a simple way, if the client application wants to check
    every time the internet status of a given system before connecting to
    the remote server how can it be achived by using standard Unix-network
    Apis
     
    Ravindra.B, Aug 6, 2008
    #5
  6. Ravindra.B

    santosh Guest

    Re: Application to check the Internet status??

    Ravindra.B wrote:

    > On Aug 6, 3:10 am, Antoninus Twink <> wrote:
    >> On  5 Aug 2008 at 12:46, Ravindra.B wrote:
    >>
    >> > I tried checking internet status of my system by issuing ping to
    >> > some well known server like google.com. But, the problem is that
    >> > ping is not working if target address is not within the same
    >> > network. I actually started writing small application, which can
    >> > tell the internet status of the given system by using some standard
    >> > network Apis. It would be great if some one suggest me how to
    >> > proceed for this.

    >>
    >> I'm not completely sure what it is you want to do. It may just be a
    >> DNS problem - otherwise you could try a traceroute and see how far
    >> your packet gets before being dropped.
    >>
    >> As for doing this in C, I can't think of a standard ping library -
    >> you could download a ping program from the web and include the code
    >> in your program, or just write it yourself using basic networking:
    >> you need to send an ICMP echo request packet, and then receive
    >> (hopefully...) the echo back.
    >>
    >> If you need more information, describe the problem clearly!

    >
    > Well, the requirement is something like this...a small api/function
    > which could tell if the internet connection is available or not and in
    > either case it should send a userfriendly message to the application.
    > To put it in a simple way, if the client application wants to check
    > every time the internet status of a given system before connecting to
    > the remote server how can it be achived by using standard Unix-network
    > Apis


    Please note that networking is not defined in any manner by the C
    Standard and you will need to use system specific extensions to attempt
    what you want. For that a group dealing with your system is a much
    better place than here. If you program uses the POSIX APIs ask in
    comp.unix.programmer, if it uses the Windows API ask in
    comp.os.ms-windows.programmer.win32 or another suitable group.

    <OT>
    The usual method is try to connect and handle failure. This is a bit
    like trying to read a byte and getting end-of-file or error in C.
    </OT>
     
    santosh, Aug 6, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. saha
    Replies:
    0
    Views:
    4,076
  2. Shug
    Replies:
    13
    Views:
    903
    Philipp
    Dec 15, 2006
  3. Shug
    Replies:
    13
    Views:
    958
    Philipp
    Dec 15, 2006
  4. harryos
    Replies:
    0
    Views:
    388
    harryos
    Oct 13, 2010
  5. Sven S.

    status info like rc.status

    Sven S., Dec 9, 2008, in forum: Ruby
    Replies:
    2
    Views:
    181
    Sven S.
    Dec 11, 2008
Loading...

Share This Page