Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Application to check the Internet status??

Reply
Thread Tools

Application to check the Internet status??

 
 
Ravindra.B
Guest
Posts: n/a
 
      08-05-2008



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
 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      08-05-2008
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.

 
Reply With Quote
 
 
 
 
Richard Bos
Guest
Posts: n/a
 
      08-05-2008
"Ravindra.B" <(E-Mail Removed)> 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
 
Reply With Quote
 
Antoninus Twink
Guest
Posts: n/a
 
      08-05-2008
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!

 
Reply With Quote
 
Ravindra.B
Guest
Posts: n/a
 
      08-06-2008
On Aug 6, 3:10*am, Antoninus Twink <(E-Mail Removed)> 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
 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      08-06-2008
Ravindra.B wrote:

> On Aug 6, 3:10*am, Antoninus Twink <(E-Mail Removed)> 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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
how to check what ports are being used by an application to communicate on internet?? ashjas Computer Support 5 07-09-2006 09:17 PM
how to selecet check box in the data grid ?? only one check box mit ASP .Net 1 01-25-2006 06:47 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
.Net Pro include Visual Source Safe or other Code Check in Check out software? Davisro ASP .Net 1 06-14-2004 03:23 PM



Advertisments