I tested on Ubuntu 18.04 LTS the venerable netcat. The netcat comes from OpenBSD:
$ dpkg -l|grep netcat ii netcat-openbsd 1.187-1 amd64 TCP/IP swiss army knife
When I use
nc -v -v -v -l -p 1234 to open the server and subsequently
nc -v -v -v localhost 1234 to open the client, I observe the following behavior:
- If client is closed with
^C, this will close both the client and the server
- If server is closed with
^C, this will close only the server without affecting the client
Why is the behavior asymmetric? Shouldn't the client be closed if the server is closed?
It seems that after the server is closed, typing any line of text into the client finally causes the client to close, as well.