LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket write in CVI causes program to pause when network connection is unreliable.

I have an application that send a large string (~1000 bytes)to a remote datasocket server. When the network connection is slow, or the unit cannot send that one packet, it causes the system to pause (lock-up) for about 15 - 20 seconds (a timeout value it seems). Then it will happen again if the network is still not up. With a good connection, all works fine. This system is on a remote drilling unit and it connects via tcp radio modem. I have tried running the "write" routine in it's own thread, and this still happens. How can I make it so it does not lock up. The data is not that important, I can miss a few "bursts" and not have a problem with my readers.
0 Kudos
Message 1 of 3
(3,123 Views)
Hello,
When writing data to a datasocket, if there is no connection and you try to do a write, you should receive an error. Have you tried checking the connection status to be sure that you are connected before you send data? As far as doing the write in a separate thread, be sure that if you put that in a different thread that dataSocket is setup to work in AutoUpdate mode and that none of the datasocket communication relies on User Interface manipulation. Be sure as well that you open the DataSocket in the new thread. I also wanted to note that when you run datasockets in a different thread, it still wouldn't effect the fact that the datasocket thread would stop responding for a few seconds, it would just allow the User Interface to still be updated during that t
ime. Hope this helps!

Regards,
Steven B.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(3,123 Views)
Steven,
Thanks for the reply. I was using a seperate thread to write, however I did not use a thread to open the datasocket connection. I now use a thread to open initially and to re-open when needed. I am testing this now on the bench before updating the live drilling units. I'll keep you posted as to the results.
0 Kudos
Message 3 of 3
(3,123 Views)