Application to check the Internet status??

R

Ravindra.B

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
 
S

santosh

Ravindra.B said:
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.
 
R

Richard Bos

Ravindra.B said:
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
 
A

Antoninus Twink

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!
 
R

Ravindra.B

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
 
S

santosh

Ravindra.B said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top