10-20-2005 04:27 PM
10-21-2005 03:27 AM
I can't confirm the odd behaviour you are seeing. What LabVIEW version is this? And try with a timeout of 1ms instead.
@gsoren wrote:I am trying to make a non-blocking tcp read call. I used a zero for the timeout, but that just caused strange behavior (the program slows down and speeds up oddly). I would like to have it check the buffer and return if no data is available, similar to how it can be done in C++. Anyone know how to do this?
10-21-2005 09:39 AM
10-21-2005 09:57 AM
Could it be that in your application you are trying to do very fast non-blocking calls. If you have a loop trying to do no-blocking calls with timeout 0 repeatedly for some time you could encounter this behaviour. LabVIEW basically will check as fast as possible if there is something to be read from the TCP/IP socket and this might monopolize the CPU for other things. In that case try to make a significant delay between calls to a TCP Read with 0 timeout.
@gsoren wrote:
It's LabVIEW 7.1. I had a 1 ms timeout and then switched it to 0, and that's when the odd behavior started. The program would run at normal speed for about 5 seconds, then slow down dramatically for about 5 seconds and then speed back up. It stopped when I put the timeout back to 1 ms. I would really like it to be a non-blocking call, but it seems like you can't do that in LabVIEW.
10-21-2005 10:28 AM
Have you tried putting the tcp requests in its own timed loop (multitthread). One loop can run independently communicating with TCP and the rest of the program can run asynchronously. This might solve the problem of blocking because the TCP wait will not hold up your programs normal execution, then you can increase your timeout settings so that the tcp will request data at a slower rate and the main program will execute at a high speed. Communicating between loops can be done with queues or shared variables.
Paul