Possible to use TCP/IP sock?

257 views
Skip to first unread message

Charley Fan

unread,
Jan 27, 2015, 12:54:32 PM1/27/15
to pytho...@googlegroups.com

I have an Agilent 4294A impedance analyser, it can be connected via the following VISA resource from LabView:

TCPIP0::10.0.0.250::5025::SOCKET


However, when I try to connect via python-ivi:
import vxi11
instr
=  vxi11.Instrument("TCPIP0::10.0.0.250::5025::SOCKET")


I get the following error message:

Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
 
File "build/bdist.linux-x86_64/egg/vxi11/vxi11.py", line 357, in __init__
vxi11
.vxi11.Vxi11Exception: Invalid resource string [init]


Am I missing something obvious? Thanks!

Charley Fan

unread,
Jan 28, 2015, 6:44:47 AM1/28/15
to pytho...@googlegroups.com
Just realised I can use plain old sockets and skip vxi11 altogether.

Alex Forencich

unread,
Jan 28, 2015, 12:32:01 PM1/28/15
to pytho...@googlegroups.com
Speaking of sockets, implementing a socket wrapper in python-ivi is on my to-do list.  Does that instrument really not support vxi11?

Alex Forencich


On 01/28/2015 03:44 AM, Charley Fan wrote:
Just realised I can use plain old sockets and skip vxi11 altogether.
--
You received this message because you are subscribed to the Google Groups "python-ivi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-ivi+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Student

unread,
Dec 15, 2016, 5:29:28 PM12/15/16
to python-ivi
I'm running into the same issue:

instr = vxi11.Instrument("TCPIP::192.168.0.26::5025::SOCKET")
Vxi11Exception: Invalid resource string [init]

My instrument (a HMC8012) is supposed to be able to use vxi11. How does the workaround with sockets work?

Thanks!

Alex Forencich

unread,
Dec 15, 2016, 5:46:59 PM12/15/16
to pytho...@googlegroups.com

If your instrument supports VXI-11, why do you need to open a socket?

VXI-11 is a higher-level protocol which uses sockets internally.  So if you aren't using python-ivi, then just open a socket directly from python.  If you want to use python-ivi, then I need to put together a wrapper that will open a socket instead of using python-vxi11.  This is on my to-do list. 

Here is a quick example for how to open a TCP socket in python:


import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect(("192.168.0.26", 5025))

sock.send("*idn?")

print(sock.recv(512))


Alex Forencich

signature.asc
Message has been deleted

Student

unread,
Dec 16, 2016, 5:02:49 PM12/16/16
to python-ivi
Thank you for the explanations and the code - as I'm new to controlling instruments via Ethernet that is super helpful! I tried the code: It fails for me at print(s.recv(512)) with "Interrupted system call" - almost there, do you have a hint to do the last step? Thank you! Its starting to be fun :)

Best, Student

Student

unread,
Dec 16, 2016, 7:24:19 PM12/16/16
to python-ivi
Ahhh - got it myself - yes why am I not using vxi11 all the time - sockets are not necessary :) Thanks again for that hint :)

Ulrich Lukas

unread,
Mar 11, 2019, 6:13:35 PM3/11/19
to python-ivi
Hi,


as a late follow-up, it really makes sense to use raw sockets instead of the RPC based VXI-11 protocol because for many instruments, this offers vast speed improvements.

Quoting:
http://lxistandard.org "HiSLIP for Fast Remote Control of LXI Instruments":

"Sockets and HiSLIP provide a 2-5 times faster interface to LXI instruments than VXI-11."


==> I can confirm exactly that with my hardware which is a R+S RTH series portable oscilloscope and a Rigol DS1054Z.


==> I just now added the SOCKET resource support, please have a look at the feature request with added pull request at https://github.com/python-ivi/python-ivi/issues/75

==> Please let me know if there are any issues.

HTH,
Ulrich

Reply all
Reply to author
Forward
0 new messages