# TCPIP to Virtual Serial printers

**URL:** <https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835>\
**Category:** SLES Configure-Administer\
**Created:** [January 15, 2018, 7:42pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835 "2018-01-15T19:42:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![johngoutbeck](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@johngoutbeck](https://forums.suse.com/u/johngoutbeck)\
**Post date:** [January 15, 2018, 7:42pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/1 "2018-01-15T19:42:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [January 15, 2018, 9:31pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/2 "2018-01-15T21:31:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [January 16, 2018, 1:54pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/3 "2018-01-16T13:54:34Z")

</div>

[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](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

---

<div class="post-metadata">

**Author:** ![johngoutbeck](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@johngoutbeck](https://forums.suse.com/u/johngoutbeck)\
**Post date:** [January 17, 2018, 6:21pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/4 "2018-01-17T18:21:49Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![johngoutbeck](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@johngoutbeck](https://forums.suse.com/u/johngoutbeck)\
**Post date:** [January 17, 2018, 6:36pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/5 "2018-01-17T18:36:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [January 17, 2018, 7:55pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/6 "2018-01-17T19:55:50Z")

</div>

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.

* * *

> [@johngoutbeck;50591](#):
>
> 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.

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.

> [@johngoutbeck;50591](#):
>
> 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.

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

Regards,  
J

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [January 17, 2018, 8:12pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/7 "2018-01-17T20:12:34Z")

</div>

Hi,

I just stumbled across a manual for the NETRS232 ( [http://sgcdn.startech.com/005329/media/sets/NETRS232\_2GB\_Manual/NETRS232\_2GB.pdf](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

---

<div class="post-metadata">

**Author:** ![johngoutbeck](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@johngoutbeck](https://forums.suse.com/u/johngoutbeck)\
**Post date:** [January 29, 2018, 5:40pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/8 "2018-01-29T17:40:32Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [January 29, 2018, 6:58pm UTC](https://forums.suse.com/t/tcpip-to-virtual-serial-printers/31835/9 "2018-01-29T18:58:25Z")

</div>

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
