TCPIP to Virtual Serial printers

Hello All;

We have several Serial-to-IP Ethernet Devices (Startech NETRS2321E).


The Serial-to-IP Ethernet Device comes with a Windows virtual com (vcom) driver. I can set up the Windows vcom driver to make the connection to the Serial-to-IP Ethernet Device. Then use putty (on the Windows PC) to connect to the vcom and print on the serial printer. Now I need to have this happen on Linux.


OS = SLES 12 SP2

I have a need to have several text streams of TCPIP inupt and output to virtual serial which are connected to Serial-to-IP Ethernet Devices, which are connected to real serial printers.

So the stream goes
TCPIP → vcom → Serial-to-IP device → Serial printer
really
incoming tcpip stream (IP1:port1) → vcom (com parameters = physical serial printer parameters, eg 9600,n,8,1) → Serial-to-IP device (its IP:port) → Serial printer

This needs to be a permanent connection even when the Linux server restarts. And I need to have 4 streams (on different IP address:port combos)

So the multiple streams go
TCPIP stream1 → vcom1 → Serial-to-IP device1 → Serial printer1
TCPIP stream2 → vcom2 → Serial-to-IP device2 → Serial printer2
TCPIP stream3 → vcom3 → Serial-to-IP device3 → Serial printer3
TCPIP stream4 → vcom4 → Serial-to-IP device4 → Serial printer4


SO I need three (3) things to make this work

  1. setup up vcom ports to print to the Serial-to-IP Ethernet Device
  2. forward the TCPIP stream to a vcom port
  3. permanent tcpip to vcom even upon reboot.

Can anybody help with this setup?

Hi
Just to clarify a few things, I’m assuming the NETRS2321E device has an ip address configured which is what your wanting to stream to?

So it’s really;

TCPIP stream → NETRS2321E (some ip address) → serial conversion → serial printer

If this is the case then the socat command (zypper in socat) should be able to set things up for you.

[QUOTE=johngoutbeck;49920]Hello All;

We have several Serial-to-IP Ethernet Devices (Startech NETRS2321E).


The Serial-to-IP Ethernet Device comes with a Windows virtual com (vcom) driver. I can set up the Windows vcom driver to make the connection to the Serial-to-IP Ethernet Device. Then use putty (on the Windows PC) to connect to the vcom and print on the serial printer. Now I need to have this happen on Linux.


OS = SLES 12 SP2

I have a need to have several text streams of TCPIP inupt and output to virtual serial which are connected to Serial-to-IP Ethernet Devices, which are connected to real serial printers.

So the stream goes
TCPIP → vcom → Serial-to-IP device → Serial printer
really
incoming tcpip stream (IP1:port1) → vcom (com parameters = physical serial printer parameters, eg 9600,n,8,1) → Serial-to-IP device (its IP:port) → Serial printer

This needs to be a permanent connection even when the Linux server restarts. And I need to have 4 streams (on different IP address:port combos)

So the multiple streams go
TCPIP stream1 → vcom1 → Serial-to-IP device1 → Serial printer1
TCPIP stream2 → vcom2 → Serial-to-IP device2 → Serial printer2
TCPIP stream3 → vcom3 → Serial-to-IP device3 → Serial printer3
TCPIP stream4 → vcom4 → Serial-to-IP device4 → Serial printer4


SO I need three (3) things to make this work

  1. setup up vcom ports to print to the Serial-to-IP Ethernet Device
  2. forward the TCPIP stream to a vcom port
  3. permanent tcpip to vcom even upon reboot.

Can anybody help with this setup?[/QUOTE]

according to https://www.startech.com/Networking-IO/Serial-over-IP/rs232-serial-device-server~NETRS232 , the device supports plain telnet streams - which means that you simply open a TCP connection from the Linux machine to the telnet port of the NETRS232 device (i.e. via “socat”, as suggested by Malcolm).

What keeps me puzzled is your last requirement: “permanent tcpip [to vcom] even upon reboot”. When the Linux machine (or the Windows machine providing the VCOMs, in case you must for whatever reason chose that route) gets rebooted, the TCP session will terminate. It can be reestablished automatically upon boot, but what exactly is it that makes you state that requirement this way?

Regards,
J

Hello;

Thanks for the information.

Yes, the NETRS2321E device has an ip address configured and is waiting for a Serial-to-IP connection. It is not a print server (like a HP JetDirect) but a Serial-to-IP Ethernet Device.

This is almost correct
TCPIP stream → NETRS2321E (some ip address) → serial conversion → serial printer
This is more correct
VCOM (Serial over IP [it is a TCPIP stream]) → NETRS2321E (some ip address) → serial conversion → serial printer


We need the VCOM and TCPIP stream to be up and running all the time, even after a reboot without manual intervention. This way we can ask anyone to restart the box/server and it will autostart the apps (vcoms and ser2net).

I found a way to create a /etc/init.d start sequence from https://www.linuxin.dk/node/21615
this will autostart any scripts I put in the start.d dir


I did find a solution for vcoms using the Tibbo Virtual Serial Port Driver for Linux (VSPDL). I tried socat, but could not get it to work for me.

And the using ser2net v3.5 to forward a text tcpip stream to the vcoms.

So far all is working on my test systems. Need to further test.

Hello;
Thank for the replies.

Yes, the NETRS2321E device has an ip address configured. But it is not a print server (like a HP JetDirect) but a Serial-to-IP Ethernet Device.

The flow is nearly correct
TCPIP stream → NETRS2321E (some ip address) → serial conversion → serial printer

This is more correct

VCOM (Serial-to-IP [it is a TCPIP stream]) → NETRS2321E (some ip address) → serial conversion → serial printer

Final connectivity will be
incoming text TCPIP steam → TCPIP to Serial conversion → VCOM (Serial-to-IP) → NETRS2321E → serial conversion → serial printer → paper readout


What we need for “permanent tcpip [to vcom] even upon reboot” is the ability to have the vcoms and forwarded text TCPIP streams. this way we can ask anyone to restart the box/server and the apps will be autostarted and ready for use without manual intervention.


I tried socat and I could not get it to work. found Tibbo Virtual Serial Port Driver for Linux (VSPDL) wich worked. Then installed ser2net v3.5 for the TCPIP to Serial conversion. Now I can print the incoming text TCPIP steam to the serial printer. This is only a test setup. Should have in production soon.

Thank you.

Hi,

[QUOTE=johngoutbeck;50591]Hello;
Thank for the replies.

Yes, the NETRS2321E device has an ip address configured. But it is not a print server (like a HP JetDirect) but a Serial-to-IP Ethernet Device.

The flow is nearly correct
TCPIP stream → NETRS2321E (some ip address) → serial conversion → serial printer

This is more correct

VCOM (Serial-to-IP [it is a TCPIP stream]) → NETRS2321E (some ip address) → serial conversion → serial printer[/QUOTE]

are you talking about RFC2217? Support for that is said to be available for socat.

[QUOTE=johngoutbeck;50591]Final connectivity will be
incoming text TCPIP steam → TCPIP to Serial conversion → VCOM (Serial-to-IP) → NETRS2321E → serial conversion → serial printer → paper readout[/QUOTE]

or looking at it “device-vise”: linuxmachine:/dev/ttyMyPrinter1 → TCP/IP via LAN → NETRS2321E → serial port → printer.


This should be a simple matter of starting the required socat processes on boot (“socat PTY,link=/dev/ttyMyPrinter1 TCP:printer1:23”, maybe substituting 23 for a more proper port number for your NETRS232) and then using /dev/ttyMyPrinter1 by whatever software is driving your printer.

Whatever makes it work for you is ok - but I’m curious what the problem was with socat :slight_smile:

Regards,
J

Hi,

I just stumbled across a manual for the NETRS232 ( http://sgcdn.startech.com/005329/media/sets/NETRS232_2GB_Manual/NETRS232_2GB.pdf ) which states that the port mode needs to be configured for RFC2217 mode - running it in “driver mode” may have contributed to the problems when using socat.

Regards,
J

Hello jmozden;

The PDF you found is not the model we have.

We have the Startech NETRS2321E.

PDF is https://www.startech.com/media/products/NETRS2321E/PDFs/NETRS2321E_Datasheet.pdf

This model does not support RFC2217, at least the PDF does not mention RFC2217.

Have a good day.

ok, that’s good to know. I used “NETRS2321E” when searching, only above link turned up and I had hoped that the firmware might be the same. Too bad it isn’t.

Regards,
J