write either this on client side . notice the "raw" .
socat unix-connect:socket -,raw,echo=0
or this on server side . notice the "echo=0"
socat unix-listen:socket exec:"python",pty,echo=0
but not both . alternatively raw on client stdio with echo=0 on the server pty is fine , but echo=0 must not be applied twice .
lets look at the two 1+1's . they are echos but with different meanings . the first echo is from line buffering of the client terminal , and the second is from the terminal on the server side created by socat .
>>> 1 + 1;
1 + 1;
2
use of echo=0 alone on client stdio , socat informs its controlling terminal ( i.e. xterm or anything like ) to disable the echoing ( on-screen-display ) of stdio buffer , thus the first 1+1 disappears , and the second will show in the very place once return key is pressed . echo=0 on server pty prevents socat from echoing ( ping-pong ) the input it receives back to the client , thus the second 1+1 disappears . with raw on the client , buffering of stdio is disabled so every key don't wait till a return to be sent to the server , and server echos the key back immediatly . use raw on client stdio along with echo=0 on client stdio when a key is pressed it is first sent to the server then the server sends it back and is displayed on the client . use raw on client stdio along with echo=0 on server pty when a key is pressed it is displayed simultanously as it is sent to the server , but is never sent back .
for commandline editing , sometimes it is sufficient to buffer a line on the client side and not send a whole line until we finish editing this line . however if powerful smart completion is desired , server side involvement is necessary .