11-19-2009 08:36 PM - edited 11-19-2009 08:39 PM
How can I get an application to wait for a VISA-TCP to wait for all of the data to be written? I have tried using both the synchronous and asynchronous modes of the VISA write but the application is not waiting for all of the data to be transmitted. Using a LAN analyzer I can see that the program continues on even though the lower level drivers handling the TCP stack are still writing data out to the device. Unfortunately for the test that I am doing I cannot rely on a response from the device to indicate that it has received all of the data. A look through the VISA events didn't find anything remotely related to this.
My application is repeatedly opening a connection to the device, sending some data and then closing the connection. This application is simulating a print queue and traces of actual print queues show that it waits to establish a new connection until the previous job has been completed. My LabVIEW application has this logic however from watching the program execution as well as the network trace it is clear that the application is not actually waiting until the data has actually been completely transmitted. Once the VISA write passes the data to the stack (some lower level code, Winsock possibly) it returns immediately.
Any thoughts?
Cross posted on LAVA: http://lavag.org/topic/11467-how-can-i-wait-for-visa-tcp-write-to-complete/
11-20-2009 06:25 AM
Mark,
Is it possible to create a virtual instrument that is running resident on your machine? Use another synchronous write to this virtual instrument after you send the data to the device under test, then you can hold up execution till you receive data to this new virtual instrument?
Just a thought rather than using a static wait. Another, more exotic thought if you are using Windows, would be to use the dotNet TCP assemblies, or if the device has drivers, interface directly with those drivers.
All are work arounds to be sure, but maybe something will shake out from alternative thinking.
11-20-2009 11:59 AM
11-21-2009 07:33 AM
I've not used VISA for TCP operations, but could you establish ANOTHER connection immediateley after sending?
Something like:
Maybe (I'm not sure) the second OPEN would wait until the actual queue was empty.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-21-2009 10:42 AM
11-21-2009 06:39 PM
Could you establish a dummy receiver within your LabVIEW code?
Transmit the data both to your real device and a dummy receiver?
When the dummy receiver sees it, that means it's really gone out the door, and it signals your main loop that it's gone.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-22-2009 12:38 AM