Why can't I netcat into my Rigol DS2072A ?  Linux, LAN, etc. - Page 1
Forum section: electronics / testgear

author: LinuxGuy123
author_rank: Regular Contributor
timestamp: August 23, 2022, 05:42:02 pm
content: Hi.I'm trying to send some SCPI message to my DS2072A and I'm not getting any responses.It is connect to my local network via DHCP at 192.168.1.125. I can ping it with no problem.My workstation is running Fedora 36 Linux.I've tried to send several commands, such as:Code:echo ":DISPLAY:DATA? ON,OFF,PNG" | nc -w1 192.168.1.125 5555 | dd bs=1 skip=11 of=image.pngecho “:SYST:LANG?” | nc -w1 192.168.1.125 5555# echo ":DISPLAY:DATA? ON,OFF,PNG" | nc -w1 -4 192.168.1.125 5555 | dd bs=1 skip=11 of=image.png^C0+0 records in0+0 records out0 bytes copied, 136.488 s, 0.0 kB/sI've tried this both as a regular user and as SU. What am I missing ?ThanksDo I have to enable something on the scope to enable it to reply to SCPI commands ?Are there any simple tests othre than ping <scope IP> to test why it isn't work ?My scope is software version 00.03.03.sp1. Do I need to update it before SCPI commands will work ?

author: gnif
author_rank: Unknown
timestamp: August 23, 2022, 06:11:28 pm
content: Quote from: LinuxGuy123 on August 23, 2022, 05:42:02 pmThere is no need to do this as `root` as your regular user can open outgoing ports using netcat just fine. While I can't speak to the issue you're having as I am not familiar with the device or the protocol, you should know that unless you specify `-n` to `echo` it will also output a carrage return, which might be messing things up.For exampleCode:echo -n ":DISPLAY:DATA? ON,OFF,PNG" | nc -w1 192.168.1.125 5555 | dd bs=1 skip=11 of=image.png

author: LinuxGuy123
author_rank: Regular Contributor
timestamp: August 23, 2022, 06:28:24 pm
content: Quote from: gnif on August 23, 2022, 06:11:28 pmOK.QuoteAre these commands supposed to be sent with a CR or a CR/LF or nothing ?Thanks for the reply.

author: gnif
author_rank: Unknown
timestamp: August 23, 2022, 06:37:15 pm
content: Quote from: LinuxGuy123 on August 23, 2022, 06:28:24 pmThat's what I meant, I am unsure if they are, but the `echo` command by default will output a line-feed (\n) if you do not specify the -n switch if you are unaware. This can and has caught me out on occasion in the past.You can explicitly output a line feed (\n) or a carriage return (\r) with `echo` by using the -e switch, for exampleCode:echo -ne "SomeText\r\n"As to why it's not working, if it isn't this, someone here with more experience will need to provide an answer I am sorry.

author: LinuxGuy123
author_rank: Regular Contributor
timestamp: August 23, 2022, 07:21:07 pm
content: I still can't connect it over the LAN, but USB works.Code:echo "*IDN?" > /dev/usbtmc0; cat /dev/usbtmc0RIGOL TECHNOLOGIES,DS2072A,DS2D164752690,00.03.03.SP1I'll update the firmware and report back.

author: mag_therm
author_rank: Frequent Contributor
timestamp: August 23, 2022, 07:37:01 pm
content: I use ssh on linux but have not used nc, so not familiar.Firstly, are you sure that nc is listening as a server on the Rigol?To check that , you could run nmap like this, (install it first if you don't have it).nmap -Pn 192.168.1.125IT takes a minute or two. That will tell you all ports that are open and have servers.Here is an example of nmap response:$ nmap -Pn 192.168.1.16Starting Nmap 7.80 (https://nmap.org) at 2022-08-23 15:31 EDTNmap scan report for 192.168.1.16Host is up (0.0054s latency).Not shown: 998 filtered portsPORT STATE SERVICE21/tcp open ftp3389/tcp open ms-wbt-serverNmap done: 1 IP address (1 host up) scanned in 4.89 second

author: LinuxGuy123
author_rank: Regular Contributor
timestamp: August 23, 2022, 09:47:58 pm
content: $ nmap -Pn 192.168.1.125Starting Nmap 7.92 (https://nmap.org) at 2022-08-23 15:30 MDTNmap scan report for 192.168.1.125Host is up (0.037s latency).Not shown: 997 closed tcp ports (conn-refused)PORT STATE SERVICE80/tcp open http111/tcp open rpcbind5555/tcp open freecivNmap done: 1 IP address (1 host up) scanned in 0.70 secondsI updated via USB. I'll post the process in another thread.My network connection works now.$ echo "*IDN?" | nc -w1 -4 192.168.1.125 5555RIGOL TECHNOLOGIES,DS2302A,DS2DXXXXX,00.03.06Turns out these scopes have an HTTP server in them.Thanks for your help.

author: LinuxGuy123
author_rank: Regular Contributor
timestamp: August 23, 2022, 10:13:25 pm
content: QuoteHave you logged into a Rigol scope using ssh ?

author: mag_therm
author_rank: Frequent Contributor
timestamp: August 23, 2022, 11:06:22 pm
content: No, I have a new GW Instek GDS 1202B.So far I use USB media in the front socket to transfer files.There is a big manual about comms but I have not had time yet to get into it.But if your Rigol had ssh server up, you would have seen it on nmap.