Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

[DPO 4104B] readfile with raw socket

DPO/MSO/MDO4000 Series, DPO/MSO/MDO/TDS/THS3000 Series, DPO/MSO/TDS/TPS2000 Series, TBS/TBA1000 Series
Post Reply
golden21
Posts: 3
Joined: August 14th, 2018, 9:40 am
Country: France

[DPO 4104B] readfile with raw socket

Post by golden21 » August 14th, 2018, 9:50 am

Hello,
I'm looking for help achieving the following:
My need is to control a DPO 4104B scope through an application which can only use a raw socket (I didnt write the application, so I do not have choice on that... if no solution found, I'll have to rewrite it)

I made a raw socket which I use to send commands en read the answer.
This works well for most of the commands: *IDN etc work fine
I succeeded in save a screeshot on the usb drive using SAVe:IMage "E:/my_screenshot.png" (the screehshot is actually correctly saved as a .png file on the usb drive)

as I said, most of the commands and querry work well: I can get information about the scope state and configure it.
but when I send the command FILESYSTEM:READFile "E:/my_screenshot.png" and then try to read the answer (I expect a binary frame), I always run to TimeOut Error.

I tried using the visa python API, using something like data = scope.querry( FILESYSTEM:READFile "E:/my_screenshot.png"), and this work well, I retrive the binary and write it on the PC.

So why can't I have it wor;king with the raw socket ? I guess that the query method from VISA api is basically a write followed by a read, so whydoes it not work with the raw socket ?

I'll be grateful for any help !

David N
Tektronix Applications
Tektronix Applications
Posts: 558
Joined: July 31st, 2008, 8:26 am

Re: [DPO 4104B] readfile with raw socket

Post by David N » August 14th, 2018, 10:14 am

You may want to look through some of the remote programming examples on the forum at viewforum.php?f=580.

golden21
Posts: 3
Joined: August 14th, 2018, 9:40 am
Country: France

Re: [DPO 4104B] readfile with raw socket

Post by golden21 » August 14th, 2018, 10:27 am

I had a look to this page (and a lot more), but I only find topics which use VISA (PyVisa, .dll or other support), not using a raw socket connexion to send raw bytes.
I'm looking for a raw solution, and also, if anyone had any explaination about the different behaviour between raw sockets and VISA sockets, I'd be glad to know !

Once again, my problem is that with a raw socket using function such as write(string), and bytes read(max_size),
If i run :
- write("*IDN?")
- data = read(100000)
I got an answer, which is correct. This works with any querry which answer is a string

but if i run:
- write("FILESYSTEM:READFile "E:/my_screeshot.png"
- data = read(100000)
I raise a TimeOut. Not a single byte received. This NEVER WORK for any cmd which answer is a binary frame

I don't understand the difference with using VISA (except that it works with VISA) to explain it and find a solution

Carl M
Tektronix Applications
Tektronix Applications
Posts: 797
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: [DPO4104B] readfile with raw socket

Post by Carl M » August 14th, 2018, 4:35 pm

Raw sockets is tricky because computer networking is by design asynchronous and data can be fragmented. TCP guarantees that you will get the data in the exact order it was sent but the data can still be split up into countless pieces and you are never sure how long it will take. Raw socket control of instrumentation is effectively without protocol. There isn't any metadata or header information. The message is dumped directly into a network packet. fire and forget. Since instrument commands and replies vary in size, raw socket instrument control is dependent on message termination. for the DPO4104B, this the linefeed byte, 0x0a or '\n' in Python.

Alternatively, VXI-11 (the typical VISA TCPIP connection) is a protocol specifically developed for instrument control. As such, VXI-11 has headers and the necessary metadata to detect low level connectivity problems and will raise exceptions as necessary. the design of VXI-11 guarantees robustness.

Which one is "better" is entirely dependent on your application and preferences. VXI-11 is robust but has a performance penalty. Raw sockets is greater control and efficiency but increases the software development burden.

I generally do not recommend the use of raw sockets with VISA.
Tektronix Application Engineer

golden21
Posts: 3
Joined: August 14th, 2018, 9:40 am
Country: France

Re: [DPO 4104B] readfile with raw socket

Post by golden21 » August 15th, 2018, 10:23 am

OK, thanks for the explication provided !
But I still don't get the following point:
When i send, let's says <*IDN?\n> through the socket, and then just read on it, I get the answer correctly
So sending <FILESYSTEM:READFile "E:/my_screenshot.png"\n> should at least result in reading a part of the answer, doesnt it ? I can't understand why the tiemout error, even with a very long delay (30s), while it works perfectly using the visa API (and is done within a few ms duration)
I'm not talking about parsing the binaries data retrieved (which is trivial as I just want to wrtie it in a binary file without any change), just about receiving something, which I don't...

Post Reply

Return to “Non- Windows Based Oscilloscopes”

Who is online

Users browsing this forum: No registered users and 1 guest