Jakub Jelen reported at Fedora that "nc -l 8080" (terminal #1) and "echo
XXX | nc localhost 8080" (terminal #2) keeps hanging both client and server
after reading the EOF, even the last sentence of "CLIENT/SERVER MODEL" in
the man page of nc(1) says "The connection may be terminated using an EOF
(ā€˜^Dā€™)."

Based on Freenode #openbsd IRC the observed behaviour is correct but the
man page should be updated, so my proposal is posted below. As I'm not sure
if -N should be added to 'server' and 'client' side, I've cloned the "DATA
TRANSFER" section, which covers the 'client' side only. Feel free to adjust
my proposal as necessary.


Thanks,
  Robert

--- nc.1        2020-02-12 14:46:36.831500390 +0000     1.95
+++ nc.1        2021-03-30 02:22:34.545148296 +0200
@@ -414,7 +414,7 @@
 .Pq or a second machine ,
 connect to the machine and port being listened on:
 .Pp
-.Dl $ nc 127.0.0.1 1234
+.Dl $ nc -N 127.0.0.1 1234
 .Pp
 There should now be a connection between the ports.
 Anything typed at the second console will be concatenated to the first,
@@ -427,7 +427,10 @@
 .Sq client .
 The connection may be terminated using an
 .Dv EOF
-.Pq Sq ^D .
+.Pq Sq ^D
+if the
+.Fl N
+flag was given.
 .Sh DATA TRANSFER
 The example in the previous section can be expanded to build a
 basic data transfer model.

Reply via email to