Join GitHub today
ncat not closing connection after remote end does.. #1413
ncat keeps the connection open after the remote end closes it... ( tested: TCP and unix connections )
i have just compiled the current verison from git (dd75a8f) on debian sid to verify that the issue still exists, and it does.. TCP/IP example:
shell-1 ~> nc -l -p 1342
shell-2 ~> nc local 1342
unix domain socket example:
photon@w520 ~> nc -U /tmp/.n/s/53BNMpXBtETx_5xqiZcwlQ
socat and the 'original' netcat behave as expected in all those cases, example:
photon@w520 ~> socat - tcp:127.0.0.1:242
..greetinx and thanks for the great work! : )
It's hard to say what is "correct" in many of these cases, though we strive for compatibility with traditional and OpenBSD netcats. Here's some documentation of known cases that may help you out: Ncat/EOF behavior on SecWiki.
I'm not closing this yet, though: I want to investigate whether this really is a bug first, and at least be able to tell you exactly why Ncat acts this way.
I understand.. yet the current behavior is that it will exit with 'broken pipe' if you try to send further bytes on such a closed connection, but only then.
btw, just to be clear on this: this is no half-open connection, i had changed my code to call shutdown(2) before the close, so that it is explicit.. in such a case writing to that remote would have been impossible, (beyond the IP stack discarding it after close()) ... so i think it really is an actual bug, even with the desire of half closed connections in mind, since there is nothing the cat could ever do from this point on than to exit..