LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP: No Response after 1-5 min

The setup:

 

I have two Windows XP computers sharing data through TCP, a client (C) and server (S). S listens on a port and C connects, which has the OK signal on the error wire. C writes about 32 bytes every minute or so to S in a while loop.

 

The problem:

 

After 1-5 minutes the data transfer stops, but the connection is still open. The program seems to stall after the TCP Write command on C's VI. If I physically walk over to the server and click on the VI, the TCP Write occurs and everything works!

 

I've tried setting the process priority for LabVIEW (in Task Manager) to higher, but it doesn't resolve the issue.

 

Does anyone have an idea of what is going on? 

0 Kudos
Message 1 of 9
(4,207 Views)

Since there have been no responses, I'll try to clarify.

 

The problem is that my TCP connection between two VIs stalls during a TCP write (the timeout is set to -1). If I physically go over to the other VI and click somewhere on the LabVIEW program, such as on the window title or the front panel, the TCP write occurs and everything works.

 

This is a problem because I have to walk over to the other computer to make the network write work ... when I want to have remote control!

 

???

0 Kudos
Message 2 of 9
(4,176 Views)

Hi mtb999,

do you use something inside your vi which needs a user reaction? Can you show your code?

 

Mike

0 Kudos
Message 3 of 9
(4,173 Views)

The server VI is simple: it stalls at the TCP read shown.

 

The client VI, which is writing the command to the server, is a bit more complicated, but basically the subVI labelled "2" does the TCP write. The connection is sustained in the while loop, and doesn't open and close each time and read/write is performed. 

 

(The subVI with the checkmark verifies that the input is suitable).

Message Edited by mtb999 on 06-16-2009 12:01 PM
Download All
0 Kudos
Message 4 of 9
(4,166 Views)

Hi mtb999,

which value do you really send over tcp/ip? is it a double value as it looks like in your image? In this case the "bytes to read" is to small.

 

Mike

0 Kudos
Message 5 of 9
(4,139 Views)

It isn't shown in those images of the block diagram, but the double is converted into a 7-character string. Then, the bytes to read is set to 7.

 

Any other ideas? The problem persists, and we have to click on the server's window periodically to make the server finish the TCP read.

0 Kudos
Message 6 of 9
(4,036 Views)

Hi mtb999,

can you upload your vi`s? Can you reproduce this behavior on another pc?

 

Mike

0 Kudos
Message 7 of 9
(4,009 Views)

but the double is converted into a 7-character string. Then, the bytes to read is set to 7.

 

I wouldn't do that if I were you.

 

If you FLATTEN the double to a string, then it's always eight bytes, and you know to read eight bytes and unflatten it at the receiving end.

 

If you CONVERT it to a string, it won't always be 7 bytes. 

Message Edited by CoastalMaineBird on 08-16-2009 06:02 AM
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 9
(3,999 Views)

If I physically go over to the other VI and click somewhere on the LabVIEW program, such as on the window title or the front panel, the TCP write occurs and everything works.

 

THAT is the weird part.  There's no mechanism I know of to react to a click on the title bar, from within LabVIEW.

 

However, is your receiving computer set to sleep after a time?

 

It sounds like the computer is going to sleep, thinking it's not being used.  A click anywhere wakes it up. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 9
(3,997 Views)