LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Socket connection - Read error when data not avalible

Hi guys, 

 

I need your opinion in relation to reading some data over a socket connection. 

 

So, I have a server running on the local host and I have created a client with Labview to communicate with this server. I can read/write to and from server under normal conditions. But I'm facing an error when I try to read when the data is not available from server. TCP-Read function generates an error at this instance. Is it possible to check first before trying to read and read only if data available ? What is the best way to handle this situation ?

 

Thanks in advance. 

0 Kudos
Message 1 of 3
(2,657 Views)

Not really but it is not necessary. Proper operation with the LabVIEW TCP nodes is to check for a timeout error on TCP Read with a reasonable low timeout and ignore this error but handle all the other errors properly.

Rolf Kalbermatter
My Blog
Message 2 of 3
(2,635 Views)

Thanks Rolf for your input. 

 

As per your idea, I implemented a different way error handling (not 100% if this is the right method, but it seems to work). I separated error handling of TCPRead from everything else. Because if TCPRead gets this error it messes up everything else. So, when this error happens, it gets cleared straight away and the program moves on as nothing has been read.  I will post some images when I clean up the code. Once again thanks for your help.  

Message 3 of 3
(2,613 Views)