LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to test if pc is connected to TCP/IP ?

Solved!
Go to solution

Hello,

 

I have a VI how should received Datas from another PC, using a TCP/IP connection,

My VI could establish the connection, receive the data's, but if i loose the connection im not able to reconnect, because i dont know how to test if my pc is connected to the other one,

 

Thank you for your help,

Best Regards,

~~~~~~~~~~~~~~~~~~Looking for a LABVIEW JOB (In EUROPE)>~~~~~~~~~~~~~~~~~~


**The Best Way To Predict**The**Future Is To Invent It**

Salimos - View my most interesting photos on Flickriver
0 Kudos
Message 1 of 8
(4,536 Views)

HI,

For better understanding can you upload your VI.

You can also find the inbuild example, \examples\comm\TCP.llb and Data Server.vi, Data Client.vi.

Hope this helps

Message Edited by SantoshJaiswal on 03-23-2009 04:29 AM
0 Kudos
Message 2 of 8
(4,516 Views)

Hi Salim,

 

You can just try to establish a connection and check the error (if there is one).

If you want to check whether you're connected to a network you can for instance check the PCs IP address (only when using DHCP), see attached image.

 

Get IP address 

 

Hope this helps,

Daniel

 

Message Edited by dan_u on 03-23-2009 11:05 AM
0 Kudos
Message 3 of 8
(4,498 Views)

Hai,

 

if the connection with the PC is lost an error is thrown (error number: 56, 60 i remember just check it out) when you try to read or write to that system.  On detecting the error you can close the TCP connection and re-open the connection with the PCand re-transmit the data which you where not able to send in the previous attempt.

Hope this helps.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 4 of 8
(4,484 Views)

Hey,

I was checking for error 66, i think it check if the connection have been closed so i reconnect,

do you think that error 56, or 60 are better?

with regards,

~~~~~~~~~~~~~~~~~~Looking for a LABVIEW JOB (In EUROPE)>~~~~~~~~~~~~~~~~~~


**The Best Way To Predict**The**Future Is To Invent It**

Salimos - View my most interesting photos on Flickriver
0 Kudos
Message 5 of 8
(4,465 Views)
Solution
Accepted by topic author salimo

salim_mjs wrote:

Hey,

I was checking for error 66, i think it check if the connection have been closed so i reconnect

do you think that error 56, or 60 are better?

with regards,


56 is timeout. It will depend on your remote service if that should be treated as error or ignored. If it is a server application it should certainly be able to react within the timeout. But if your host applcation is the server and the remote application is the client it would be very common to receive a timeout error when polling the client if he has new data to send.

 

Checkout the previously mentioned examples they really give you a good idea about how network communication over TCP/Ip should about work, eventhough there is still a lot to be improved to create a really reliable connection. But start from there and then come back if you get trouble.

 

Rolf Kalbermatter

Message Edited by rolfk on 03-23-2009 08:14 PM
Rolf Kalbermatter
My Blog
Message 6 of 8
(4,433 Views)

Hi @  

sorry to comment on such an old thread,  but I can't find the solution I need, and I've seen your comments on similar related topics, internet connection!

I have a LV program, which has several SubVIs and they are all sending SQL queries for different functions. When I disconnect my laptop from the internet (cable), my laptop re-establishes internet within a few seconds and connect to wifi, but my program doesn't. I have found out that I can check with TCP if the connection is still there, but i don't know how to use this information, in case it is negative, how to reconnect to wifi or next available internet? can you help me with that please? I've attached the check for internet snippet part.

Seli6272@D
0 Kudos
Message 7 of 8
(300 Views)

This seems to belong to this discussion.

 

You don't need to check for generic internet connectivity. All you need to do is just try to reconnect to your SQL every second or so, until it succeeds. (Or a time is reached where it should give up).

0 Kudos
Message 8 of 8
(273 Views)