Can sombody explain why this happening and how to fix it so that the data sent to stdin behaves the same way as the data typed in to stdin.
For those who can't see the .gif
Basically i have 3 terminals setup. One is running a netcat server which is the following command.
nc -l 127.0.0.1 4000
Terminal 2 is just running a netcat client which is the following command.
nc 127.0.0.1 4000
When typing into the client which basically means inputting data to stdin or file descriptor 0 of that program. The data shows up on the server once the enter key has been hit. This is expected behavior.
One would expect that if you input data to stdin from another source than the keyboard it would work the same as long as you provide a newline at the end or even a newline and a carriage return.
Though this is not the case when running terminal 3 which has the following command.
echo "test\n" > /proc/$pid/fd/0
Oddly enough the data from echo even shows up in terminal 2 but it does not get treated as keyboard input and thus no message is sent from the clinet on terminal 2 to the server on terminal 1.
This i conclude is bullshit.