Mark Yedinak Posted November 20, 2009 Report Share Posted November 20, 2009 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 NI Forums. Quote Link to comment
Mark Yedinak Posted November 30, 2009 Author Report Share Posted November 30, 2009 Well, after speaking with NI regarding this issue it appears that at least with TCP connections, and possibly other VISA connections, it is impossible to performance a synchronous write to a device. The VISA write will return immediately after handing the data to the stack. Therefore if your communication is unidirectional it is impossible to synchronize your application with the actual transmission of the data. I see this as a major flaw since you cannot have your application wait until all the data has actually been transmitted. You can only wait until it has been buffered which is effectively immediately. I may have to experiment to see if transmitting the data in small chunks will work. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.