RES:23# I don’t know what it means either

Written by James McDonald

November 23, 2011

A company named HSAjet has a CU (Control Unit) that drives some expensive print heads for carton labelling.

In the documentation that is supplied with the Control Unit it specifies that you can communicate with it via RS232 and Ethernet.

The Ethernet part is what I’m interested in.

The command reference published in the Manual tells you that it talks via a `dialog protocol’.

That’s where it became interesting.

How to communicate over Ethernet without coding it all from scratch?

So I turned to Perl which has a module named Net::Telnet that allows for two way terminal style chat and has enumerable options.

One of the critical ones for communicating with the CU is that you turn off “Telnetmode”.

When sending a file to the CU if Telnetmode = 1 then the file get’s corrupted.

I kept getting a RES:23 error which isn’t listed in the CU manual when I was trying to send a file to the unit. I tried a lot of things such as setting Net::Telnet to binmode (which I think helped) but toggling Telnetmode to off (0) fixed the issue. This stopped Net::Telnet from interpreting data in the stream being sent to the CU as telnet commands.

This post is probably only of interest to about 3 people world wide but hey. My blog is my long term memory these days.

Here is a snippet of the Perl code to start a connection to the CU. (email me or comment if you wish for more than this sample)


my $telnet = new Net::Telnet(

	Host => "10.11.12.13",
	Port => "1500",
	Timeout => 30,
        Telnetmode = 0,
        Input_record_separator => "#", # the cu doesn't use newline it uses the hash (#)
	Output_record_separator => "#",
	# Dump_Log   => "dumplog.log", # debugging logs comment these out when you go live
	# Input_log  => "inputlog.log",
	# Output_log => "outputlog.log",
	# Option_log => "optionslog.log"
);

# basically the rest of the script is a 
# combination of print and waitfor commands
# If you are interested I can sell you the 
# Perl code for a million Zimbabwean dollars
$telnet->print("CMD:R");
my @ret1 = $telnet->waitfor('/RES:.*#/');

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...