From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Read returns no error and zero bytes

Hello All,

 

suddenly I ran into a weird problem with the TCP Read node. Here is an excerpt of my code:

 

datalengtherror.png

If I'm still OK, it should wait for 5 bytes during 30 seconds and then return 5 bytes in the data out output or timeout error. The problem is that sometimes it returns no error and zero bytes! How could this happen?

 

I'm using LV 2009 SP1. If you need any additional info on my application -- just shout.

 

Any suggestions are highly appreciated!

0 Kudos
Message 1 of 29
(3,666 Views)

Hi!

TCP Read is waiting the 30s when zero bytes are read?

Does it output a warning if not an error?

 

Regards,

Marco

0 Kudos
Message 2 of 29
(3,639 Views)

Hi Marco,

 

thank you for your reply. Both questions are interesting. Never got any warnings from TCP Read—do they exist?

 

Anyway I'll try to check and get back to you with my results. Thanks again!

0 Kudos
Message 3 of 29
(3,633 Views)

Maybe the TCP read is returning non-displayable characters.  You could try setting your string indicator to hex display.

 

 

Message 4 of 29
(3,631 Views)

Hello Max,

 

unfortunately the string is really empty—it's not shown on the VI image but surely I used String Length function to check it.

 

Many thanks for your reply anyway!

0 Kudos
Message 5 of 29
(3,628 Views)

Do you have some code that "sends" the data which reproduces the problem? That way others can run it on their computers.

0 Kudos
Message 6 of 29
(3,620 Views)

@endvr wrote:

Hello Max,

 

unfortunately the string is really empty—it's not shown on the VI image but surely I used String Length function to check it.

 

Many thanks for your reply anyway!


Where did you check the string length? Did you check it before the case statement? You could be reading partial data and returning a timeout error. Have you verified using probes (better for timing related debugging than breakpoints or execution highlighting) that you are truly executing the true case and not the error case? BTW, it is better to have the indicator outside of the case statement rather than inside it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 29
(3,618 Views)

Hello Greg,

 

thanks for the reply. Actually this code is communicating with some special hardware so it's impossible to reproduce this situation on another PC.

0 Kudos
Message 8 of 29
(3,605 Views)

Hi Max,

 

the code from the picture is just a simplified version of what I did. Actually I add logging to the No Error case and wrote data and its length to the file in case of length<>5. The result was:

 

,0

,0

,0

 

Btw, I'm also CLA 😉

 

Thanks!

0 Kudos
Message 9 of 29
(3,600 Views)

Have you tried using Wireshark or something similar to capture the network traffic. That may give you a clue as to what is happening. I have been using the TCP primitives since they first came out and have never seen this.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 29
(3,591 Views)