Direct TCP connection from RepetierServer to ser2net virtual serial port on the printer

Can I connect my remote printer on RepetierServer with TCP/IP connection method to a "ser2net" port, or do I need to install "socat" on the local machine and recreate a local serial port?

I would like to redirect /tmp/printer (/dev/pts/1) of Klipper trough the network.

Thank you.

Comments

  • The TCP connection works identical to serial communication with the difference to stream over TCP instead of serial. So as long as the port maps bidirectionally to the serial /tmp/printer use any solution you like. Don't know ser2net but sounds like it would do the correct thing. Just make sure it survives disconnects. socat closes after network is closed, so it needs to be restarted again.
  • Yes, you confirmed the result of my tests.

    Socat works well but it breaks the connection if the serial port disappear (/tmp/printer in this case).
    Ser2net should do the same things and seems easier to configure compared to socat and, besides, it runs as service, but it didn't work as expected.
    Maybe I didn't put the correct parameters in:
    cat /etc/ser2net.conf
    4001:raw:0:/tmp/printer:115200 8DATABITS NONE 1STOPBIT
    Repetier-Server doesn't connect to it, printer is offline.


    Instead socat doesn't run as service, for that I created a socat.service file in systemd to start it at boot and it restart alone if somthing goes wrong.
    pi@orangepizero:~$ cat /etc/systemd/system/socat.service
    [UNIT]
    Description=Star and Stop the socat server daemon
    [Install]
    WantedBy=multi-user.target
    [Service]
    StandardOutput=syslog
    StandardError=syslog
    ExecStart=/usr/bin/socat tcp-l:3000,keepalive,nodelay,reuseaddr /tmp/printer,b115200,raw
    User=pi
    Restart=always
    RestartSec=10
    Type=simple
    I don't know if all the parameters are correct and if it can be made better then so, anyway, if I stop the klipper service, the connecton drops and come back when klipper start again.

    Thanks
Sign In or Register to comment.