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 => "",
	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
my @ret1 = $telnet->waitfor('/RES:.*#/');


Submit a Comment

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

You May Also Like…

PC Build

I recently built myself a PC using the SilverStone SG13 Case. I am planning to use it as a Hot Spare. So any client...