dest-unreach / socat / contrib / socat-pty
In the German computer magazin Heise c't 2004/13, page 200, socat is used for redirecting a pty via TCP to a TCP-to-serial interface. The socat invocation looks something like socat pty tcp:ip-address:ip-port". Because the "pty" implementation of socat does not wait until a process opens the ptys slave side, it immediately opens the TCP connection and thus blocks the remote interface.
This patch changes the behaviour of socats pty address. It waits for a connection to the ptys slave side and only then proceeds to handling the next address.
This current solution polls the pty state until the POLL_HUP condition ends. The polling intervall is hardcoded to one second; change the value of INTERVALL in xio-pty.c if required.
Apply this patch to socat 18.104.22.168 source.
Extract the socat 22.214.171.124 source:
tar xzvf socat-126.96.36.199.tar.gz
change to the source directory:
apply the patch:
gunzip <../socat-pty.patch.gz |patch