LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

check internet connection

Hi all,

 

What's the best way these days to check for a working internet connection?

 

LV 2010.

 

Thanks,

 

Battler.

0 Kudos
Message 1 of 14
(4,433 Views)

A simple way would be to open a TCP connection to a Webserver on port 80, then close it again. Check the error cluster.

0 Kudos
Message 2 of 14
(4,427 Views)

I have a VI which does exactly that however, it returns an error and yet I definately have an internet connection. So it doesn't work for some reason.

 

I believe the IP address is for NI.com server?

 

Another problem with this solution is the delay.  There has to be a faster way.  Getting this way to work at the very least would also be good.

 

 

Internet connection.png

0 Kudos
Message 3 of 14
(4,421 Views)

I don't know that IP address (I get a timeout as well), but you could just try www.ni.com or www.google.com. No need for an IP address, the protocol will look that up for you.

 

0 Kudos
Message 4 of 14
(4,415 Views)

@battler. wrote:

I have a VI which does exactly that however, it returns an error and yet I definately have an internet connection. So it doesn't work for some reason.

 

I believe the IP address is for NI.com server?


While 130.164.140.26 may resolve back to ni.com, it is not what DNS registrations show as the IP address for ni.com. One valid one is 208.94.146.81. For now. You should really use names, not IP addresses.

 


Another problem with this solution is the delay.  There has to be a faster way.  Getting this way to work at the very least would also be good.

The delay of what? The delay only occurs if there's no connection established, in which case you hit your timeout.

Message 5 of 14
(4,411 Views)

I'll use names.  Thanks,

 

I'm still not satisfied this is the best solution.  If there isn't a connection my application should do something else, but it needs to wait for timeout which introduces delay.  What's an appropriate timeout for all situations?

 

Can I do something with System Exec instead such as check ping?

0 Kudos
Message 6 of 14
(4,405 Views)

You can use ping, but you'll have to give it some timeout as well. So I don't think that changes anything.

What is a good timeout... If you look at typical ping response times they might be in the ms range, so with 100ms timeout you should in most cases be fine. But there might be false timeouts in some cases when the network is busy.

 

0 Kudos
Message 7 of 14
(4,401 Views)

Is there Windows registry entry?

0 Kudos
Message 8 of 14
(4,399 Views)

@battler. wrote:

Is there Windows registry entry?


For what?

0 Kudos
Message 9 of 14
(4,397 Views)

@dan_u wrote:

You can use ping, but you'll have to give it some timeout as well. So I don't think that changes anything.

What is a good timeout... If you look at typical ping response times they might be in the ms range, so with 100ms timeout you should in most cases be fine. But there might be false timeouts in some cases when the network is busy.

 


Ping isn't guaranteed to work, since a lot of sites close off ping as a protection against bots that try to check for live computers. Also, the operation of ping is dependent on the operating system.

Message 10 of 14
(4,392 Views)