Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

open session failure

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

 

0 Kudos
Message 1 of 6
(4,451 Views)

open session ONCE at start of program

close session at end of program

0 Kudos
Message 2 of 6
(4,445 Views)

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

 

 

0 Kudos
Message 3 of 6
(4,443 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(4,424 Views)

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

 

http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/VISA-Read-hangs-Get-Resetting-VI-dialog-on-ab...

 

 

thanks

 

 

0 Kudos
Message 5 of 6
(4,396 Views)

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.

0 Kudos
Message 6 of 6
(4,353 Views)