473,394 Members | 1,642 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,394 software developers and data experts.

Testing Local Connection / Internet Connection

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 want to test to see if the Internet Connection is up. I need the
Internet to be up for the Web Services I am calling. Is it better to test
the Internet Connection through Pinging an IP Address (I presently do 3 ping
failures for it to be down) or some other way? Is there any eventhandler out
there for checking the internet connection?

Thanks
Mar 25 '08 #1
6 3108
On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen
<Bs******@discussions.microsoft.comwrote:
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 want to test to see if the Internet Connection is up. I need the
Internet to be up for the Web Services I am calling. Is it better to
test
the Internet Connection through Pinging an IP Address (I presently do 3
ping
failures for it to be down) or some other way? Is there any
eventhandler out
there for checking the internet connection?
The absolute best way to detect whether your web service calls will
succeed is to try them.

You can detect network availability, but that obviously won't tell you
whether you're on the Internet or just a LAN. You also cannot reliably
know whether the network will become present at some time in the future.
For example, merely attempting network access is, in some cases,
sufficient for enabling a network that was not previously present (e.g.
dial-up network adapter).

Just because the network's not there when you look, that doesn't mean it
won't be if you try to do something with it. Likewise, just because it's
there when you do look, that doesn't mean it will be when you try to do
something with it.

Along these same lines is the Internet connectivity issue. The same thing
applies: just because it's not available when you look, that doesn't mean
it won't be when you try to use it later, and vice a versa.

So, your code must handle the error cases anyway, and it's rude to the
user to provide them with false negatives (not making an attempt to call
the web service even though it might have worked). So you should just
ignore the question of whether the network is present and connected to the
Internet, and just try to use it. If it succeeds, great...if not, tell
the user and let them deal with it. They have a _lot_ more information
than your code ever could and can much more successfully handle the issue.

Pete
Mar 25 '08 #2
Peter,

Thanks so much for the prompt response.

However, I am running a standalone application where there is no user around
to deal with it. I have to deal with it. I am also dealing with FTP issues
and need both the local connection and internet connection up. Could you
please explain to me how to best do that in your opinion?

Thanks again,
Bob
"Peter Duniho" wrote:
On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen
<Bs******@discussions.microsoft.comwrote:
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 want to test to see if the Internet Connection is up. I need the
Internet to be up for the Web Services I am calling. Is it better to
test
the Internet Connection through Pinging an IP Address (I presently do 3
ping
failures for it to be down) or some other way? Is there any
eventhandler out
there for checking the internet connection?

The absolute best way to detect whether your web service calls will
succeed is to try them.

You can detect network availability, but that obviously won't tell you
whether you're on the Internet or just a LAN. You also cannot reliably
know whether the network will become present at some time in the future.
For example, merely attempting network access is, in some cases,
sufficient for enabling a network that was not previously present (e.g.
dial-up network adapter).

Just because the network's not there when you look, that doesn't mean it
won't be if you try to do something with it. Likewise, just because it's
there when you do look, that doesn't mean it will be when you try to do
something with it.

Along these same lines is the Internet connectivity issue. The same thing
applies: just because it's not available when you look, that doesn't mean
it won't be when you try to use it later, and vice a versa.

So, your code must handle the error cases anyway, and it's rude to the
user to provide them with false negatives (not making an attempt to call
the web service even though it might have worked). So you should just
ignore the question of whether the network is present and connected to the
Internet, and just try to use it. If it succeeds, great...if not, tell
the user and let them deal with it. They have a _lot_ more information
than your code ever could and can much more successfully handle the issue.

Pete
Mar 25 '08 #3
On Mar 25, 1:34*pm, Bsmengen <Bsmen...@discussions.microsoft.com>
wrote:
Peter,

Thanks so much for the prompt response. *

However, I am running a standalone application where there is no user around
to deal with it. *I have to deal with it. *I am also dealing with FTP issues
and need both the local connection and internet connection up. *Could you
please explain to me how to best do that in your opinion?

Thanks again,
Bob

"Peter Duniho" wrote:
On Tue, 25 Mar 2008 10:03:01 -0700, Bsmengen *
<Bsmen...@discussions.microsoft.comwrote:
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 want to test to see if the Internet Connection is up. *I need the
Internet to be up for the Web Services I am calling. *Is it better to *
test
the Internet Connection through Pinging an IP Address (I presently do 3 *
ping
failures for it to be down) or some other way? *Is there any *
eventhandler out
there for checking the internet connection?
The absolute best way to detect whether your web service calls will *
succeed is to try them.
You can detect network availability, but that obviously won't tell you *
whether you're on the Internet or just a LAN. *You also cannot reliably *
know whether the network will become present at some time in the future.*
For example, merely attempting network access is, in some cases, *
sufficient for enabling a network that was not previously present (e.g. *
dial-up network adapter).
Just because the network's not there when you look, that doesn't mean it*
won't be if you try to do something with it. *Likewise, just because it's *
there when you do look, that doesn't mean it will be when you try to do *
something with it.
Along these same lines is the Internet connectivity issue. *The same thing *
applies: just because it's not available when you look, that doesn't mean *
it won't be when you try to use it later, and vice a versa.
So, your code must handle the error cases anyway, and it's rude to the *
user to provide them with false negatives (not making an attempt to call*
the web service even though it might have worked). *So you should just*
ignore the question of whether the network is present and connected to the *
Internet, and just try to use it. *If it succeeds, great...if not, tell *
the user and let them deal with it. *They have a _lot_ more information *
than your code ever could and can much more successfully handle the issue.
Pete- Hide quoted text -

- Show quoted text -
Hi,

It's as simple as trying to conenct to the ftp server, if you can
connect there is connectivity TO THE SERVER, that is what you care
about in reality.
Cause, what would you call it if there is connectivity to the rest of
the internet but to your server?
Mar 25 '08 #4
On Mar 25, 1:03*pm, Bsmengen <Bsmen...@discussions.microsoft.com>
wrote:
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 want to test to see if the Internet Connection is up. *I need the
Internet to be up for the Web Services I am calling. *Is it better to test
the Internet Connection through Pinging an IP Address (I presently do 3 ping
failures for it to be down) or some other way? *Is there any eventhandler out
there for checking the internet connection?

Thanks
Hi,

And what happens if the server is up (you get ping) but the web
service is down?

Mar 25 '08 #5
On Tue, 25 Mar 2008 10:34:00 -0700, Bsmengen
<Bs******@discussions.microsoft.comwrote:
However, I am running a standalone application where there is no user
around
to deal with it. I have to deal with it.
Unless you've got a robot controlled by your code that can plug the
network cable back in, you're stuck.

My main point is that checking for network conditions before trying to use
the network doesn't benefit you in any way. If you find that the network
isn't there, that doesn't mean it won't be there if and when you try to
use it. And if you find that the network _is_ there, that doesn't mean it
will still be there if and when you try to use it.
I am also dealing with FTP issues
and need both the local connection and internet connection up. Could you
please explain to me how to best do that in your opinion?
To do what? If you're asking how to find out whether the connection is
"up", I've already explained that. If you're asking something else, I
don't understand the question.

Pete
Mar 25 '08 #6
Thanks so much for your help.
--
Bob
"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Mar 25, 1:03 pm, Bsmengen <Bsmen...@discussions.microsoft.com>
wrote:
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 want to test to see if the Internet Connection is up. I need the
Internet to be up for the Web Services I am calling. Is it better to test
the Internet Connection through Pinging an IP Address (I presently do 3 ping
failures for it to be down) or some other way? Is there any eventhandler out
there for checking the internet connection?

Thanks

Hi,

And what happens if the server is up (you get ping) but the web
service is down?

Mar 25 '08 #7

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

Similar topics

7
by: Karuna | last post by:
Hi, I have developed a website in my local machine using PHP, MySql and apache. It's not uploaded on the net. The pesrson for whom I have developed this wants to test it before actually putting it...
4
by: Stefan Mueller | last post by:
I've just installed phpMyAdmin. If I have the line $cfg = 'http://localhost/php/phpmyadmin'; in my config.inc.php I can login to phpMyAdmin without any problems from my local machine. But it's...
5
by: btopenworld | last post by:
A couple of years ago, I had a mild hack of the default windows web page in inetpub because I was running IIS whilst my DSL connection was on. Ever since, I have disconnected the DSL before running...
2
by: Lawrence San | last post by:
I'm trying to test some simple JavaScript meant to speed up the display of my Web pages for readers using modems, but I have a fast DSL connection and I'm having trouble visualizing how effective...
8
by: Jozef | last post by:
Hello, Is there a way to test that an internet connection exists and that you are able to see the webserver before performing any connections? The reason being, when I try to connect to an SQL...
16
by: Mike Malter | last post by:
I really hope this is the place to go for an answer to this question. I am coding a web project on my laptop. I need to write some code that will involve https for the payment part of the app....
4
by: Nathaniel Sherman | last post by:
Alright, folks, here's the deal... I'm working on migrating a classic ASP website to an ASP.NET codebase. At the heart of the site is a MySQL database. To make sure an "in-process" program...
8
by: mouac01 | last post by:
I'm not sure if this is possible. I would like to have a PHP app on the Internet connect and write to a local database (Intranet). For example, users would go to a web site...
11
by: Alexnb | last post by:
Hello internet. I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p -- View this message in context:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.