Hello,

I've noticed that there's a difference in behavior between nc(1) and GNU netcat when they talk to some daemon via TCP.

The commands in the following example are basically the same:

GNU netcat:
netcat host 1234 < infile

nc(1):
nc host 1234 < infile

nc(1) sends a FIN segment after all data has been read from stdin: shutdown(nfd, SHUT_WR) in netcat.c causes TCP to enter FIN-WAIT-1 state. GNU netcat doesn't do this. I've noticed that some daemons behave differently because of this, i.e., they won't return any data although they are still allowed to send data.

I think both variants are allowed in RFC 793. Would it make sense to add a further option to nc(1) which allows to toggle between both variants?

Regards
Andreas

Reply via email to