Linux/socat

Client: killall -s 9 socat; sleep 5 while true ; do /usr/bin/socat pty,link=/dev/virtual0,waitslave tcp:socatserver.oeey.com:3333 ; sleep .001 ; done

Server: /usr/bin/socat tcp-listen:3333,reuseaddr,fork file:/dev/ttyUSB0,nonblock,waitlock=/var/run/tty0.lock,b115200,raw,echo=0

socat-client.sh: set -e
 * 1) !/bin/bash

if [ -z "$1" -o -z "$2" ]; then echo "Usage:   socat-client  " echo "Example: socat-client target-pi /dev/ttyUSB0" exit 1 fi

trap "exit 1" SIGINT SIGKILL SIGTERM while true; do   killall -s 9 socat &> /dev/null || true echo "Starting socat client" /usr/bin/socat pty,link=$2,waitslave,unlink-close=0 tcp:$1:3333 done