473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to check for internet connection

Hi,

Please could you tell me how to check for an internet connection in C.
I'm using Windows 2000.

Many Thanks,
Jonny
Nov 14 '05 #1
3 6594
In article <EA**************@newsfe4-gui.ntli.net>,
Jonny <ww******@ntlworld.com> wrote:
:Please could you tell me how to check for an internet connection in C.
:I'm using Windows 2000.

How do you want to define "an internet connection" ?

If I'm using a system connected up to a multi-continent dedicated
research network with ten thousand or so members, does that qualify
as an "internet connection" ?

If I'm using a system that is nailed down and firewalled so tightly
that the -only- thing that can go out on the network is NTP time
synchronization with *one* system, then is that "an internet connection" ?
C itself has no concept of internet connections, so you will have
to use an external facility to do the work.

If you want your definition of "internet connection" to be "there is
some kind of network card, wired or wireless, ethernet or token ring or
even direct IBM SNA, and that NIC is showing that a carrier signal
exists to the card" then you are going to have to use something that is
pretty Windows specific, as there is no portable way to find out what
hardware is attached or details of its state. In such a case, you would
need to use the Windows 32 ABI, probably.

If you want your definition of "internet connection" to be "is able
to send through the network and make a TCP connection to a particular
endpoint" then you can possibly use POSIX standard sockets to just
*try* the connection and see what happens. [Though I seem to recall
reading the Windows 2000 is only fractionally POSIX, with the POSIX
integration being more advanced in XP.]
--
Take care in opening this message: My grasp on reality may have shaken
loose during transmission!
Nov 14 '05 #2
Walter Roberson wrote:
C itself has no concept of internet connections, so you will have
to use an external facility to do the work.


Thanks for your reply Walter.

I'm quite new to this, so I would be grateful if you could explain the
above to me. Do you mean that I call an external utility from within my
C program, and then get the result from it?

If I have an executable which sets an error level on Windows 2000 if
there is no "internet connection", can I run this executable and access
that error level from within my C program? Or if the executable outputs
some error text, can my C program read that text?

Your help is appreciated.

Regards,
Jonny
Nov 14 '05 #3


Jonny wrote:
Walter Roberson wrote:
C itself has no concept of internet connections, so you will have
to use an external facility to do the work.
Thanks for your reply Walter.

I'm quite new to this, so I would be grateful if you could explain the
above to me. Do you mean that I call an external utility from within my
C program, and then get the result from it?


Some library or extension that is for your system O/S


If I have an executable which sets an error level on Windows 2000 if
there is no "internet connection", can I run this executable and access
that error level from within my C program? Or if the executable outputs
some error text, can my C program read that text?
Yes You can lookup the system() function.


Your help is appreciated.

Regards,
Jonny


Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kadir CAMOGLU | last post by:
Hi all, I am writing a program with vb.net which getting some information from internet. I must check internet connection before some prosess. But how?
9
by: sleepyant | last post by:
Hi, I've posted this question on several forum but have no response. So I hope anyone who have any idea what I'm talking about please give your solution or advice. My problem is I need to check...
4
by: Peter Flynn | last post by:
I'm having trouble finding example code to detect the presence of an Internet connection. It doesn't seem to be a very frequently asked question, as all I need is the answer yes or no (is the user...
10
by: Bob Hollness | last post by:
OK. The below text is from the MySQL website. "When you connect to a MySQL server, you should use a password. The password is not transmitted in clear text over the connection. Password handling...
4
by: Fred Zuckerman | last post by:
I have a A2K database that includes some linked tables (these links are SQL views). Sometimes there are "issues" with the SQL server and the users receive a timeout error whenever they try to...
3
by: danielmcinerney | last post by:
i am trying to set up internet connection sharing between a vista machine (host) and an XP machine (client). i have followed guidelines from various pages on the internet but i still cannot get it...
1
by: jeffreykr | last post by:
hi, i am trying to this from portable code. ie, i have seen how to check for a live connection from .NET but i'm not using those libraries. any other way to check for a live internet connection...
6
by: =?Utf-8?B?QnNtZW5nZW4=?= | last post by:
I am trying to make sure that the local connection is up. I have presently been using the NetworkChange.NetworkAvailabilityChanged Event for this. Is there a better way to do this? Also, I...
1
by: =?Utf-8?B?QiBTaW5naA==?= | last post by:
Hi Scenario 1) Host - XP Laptop with internet connection using Sky Broadband Wireless Router Netgear DG834GT 2) MS Virtual Server 2005 - I have deployed an XP MS Virtual Server 2005 to act...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.