On Thu, 26 Feb 2004, Adrian Chadd wrote:
> Right. I'll compile it from source. Which kernel are you using?
Kernel is irrelevant. This has been seen from Linux-2.4.TEST1 to 2.4.24.
When netcat sees EOF in stdin it calls shutdown(fd, SHUT_WR), this causes
the TCP transmit channel to shut down (FIN sent).
Looking into details of the netcat I am using and I find it is patched
with a patch to add half-closed connection support which explains the
different behaviour we are seeing. Patch attached.
Regards
Henrik
--- nc/netcat.c.halfclose Fri Aug 11 12:59:56 2000
+++ nc/netcat.c Fri Aug 11 13:01:15 2000
@@ -1220,6 +1220,7 @@
if (rr <= 0) { /* at end, or fukt, or ... */
FD_CLR (0, ding1); /* disable and close stdin */
close (0);
+ shutdown(fd, 1); /* no more sending from us */
} else {
rzleft = rr;
zp = bigbuf_in;