Quantcast
Channel: Measurement Studio for VB6 topics
Viewing all articles
Browse latest Browse all 323

TCPIP connection to instrument closing after being idle for 6 seconds

$
0
0

I've been using the NI-VISA library in Excel VBA for controlling various instruments using TCPIP raw sockets.  Without any change to the VBA programming, connections to instruments started reporting I/O errors. Apparently something other than my VBA code is closing the socket.

 

For debug, I wrote a simple macro in VBA to loop sending instrument commands at a periodic rate.  The macro would run indefinitely without error.  If I pause it, the connection will close after 6 seconds, indicated by the "remote" light on the instrument extinguishing.  Resuming the script would result in an I/O error message.

 

Back then (three months ago) we rolled back the NI-VISA version (to 2019, I believe), and that fixed the problem temporarily.  A month later, the problem came back even though the system still thought the older NI-VISA version was installed.  My guess is that something had changed in an automatic Windows update (e.g., a driver used by NI-VISA) to break the connection.  My workaround was to rewrite the script to use direct raw socket programming, avoiding NI-VISA altogether, and haven't had any problem with that Excel VBA script since.

 

The same problem has just resurfaced in a different Excel VBA script that had previously worked.  This time, the script is talking to a different instrument from a different manufacturer.  The only commonality is using the NI-VISA library for TCPIP connections from VBA.  Unfortunately, this instrument only supports the VXI-11 TCP/IP Instrument Protocol, not direct raw sockets.

 

Is there something new in the latest NI-VISA drivers that requires me to "enable keepalive" or take some other action to make a connection persist while my script is off doing other things?  How do I fix this?

 


Viewing all articles
Browse latest Browse all 323

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>