Write to the stdin of a running process with the same effect/behaviour of directly writing

This doesn't work as you expect because /proc/<PID>/fd/0 isn't a pipe. If you invoke the sending side with it's stdin connected to a pipe it will work

On the receiving host

nc -l 10000

On the sending host

mkfifo my.fifo
cat >my.fifo &
cat my.fifo | nc remotehost.tld 10000

Now you can

echo "Hello World" >my.fifo
myprog >my.fifo

Note that the cat >my.fifo is required to keep the fifo open otherwise an EOF gets sent and the connection gets closed prematurely. To close the connection down you need to kill the cat process that is holding the fifo open.


As stated in the answer to the post you linked, you need to write to /proc/pid/fd/0, not /proc/pid/fd/1.