10-15-2015 04:36 PM
Hi I am issuing some commands to my device via NI-VISA through TCP/IP.
Here is what i do:
1.open session
2.some application specific commands
3.close session
These three steps are done multiple times and it seems most of the time the communication is fine. Once in blue moon i get an error from ni visa :
Failed to open session - Check TcpipSocket connection at address x.y.z.a(Failed command: OpenSession)
I check the device and it is running on the ip x.y.z.a, i close ni visa and reconnect to the same ip and issue *idn? i get a valid response back. I dont understand what is causing the open session to fail intermittently
thanks
10-15-2015 05:22 PM
open session ONCE at start of program
close session at end of program
10-15-2015 05:29 PM
Hi nyc, thanks for the quick reply
heres what i do..
I do open session once. do the application code and close the session on that unit
but sometimes i have two or more devices connected. So i close session on the existing unit and open new session on another unit do application code and so on.
after some time when i get back to the old unit (for which i previously closed session) to open session, it fails sometime
10-15-2015 08:32 PM
You can leave the session open, even when you are talking to multiple instruments. Imagine a test system with 10 ethernet instruments. Are you telling me you would open and close the sessions each time you change which instrument you are talking to? No. Open a VISA session for all of your instruments and then close them when your software shuts down and your life is a lot simpler.
10-16-2015 01:23 PM - edited 10-16-2015 01:25 PM
Hi crossrulz,
But technically I should be able to open and close session multiple times, which i am able to do most of the times.
I will try your suggestion but if it works, i am not sure what the root cause of this intermittent open session exception was.
I saw a similar post where ni-visa read hangs for driver V5.0.3 and above, i am using ni visa version v5.4, I dont know if these are related
thanks
10-19-2015 04:56 PM
Hi wwwwww,
I did a quick search for your error, but didn't find anything that seemed related. It's obviously not the a perfect explanation, but nyc is right. Opening and closing sessions once will very likely fix your error, since that's the way those VIs were designed to be used.