the 'nc' program doesn't seem to close the network connection anymore when it reaches EOF. This worked fine in 9.x. Can somebody else confirm this broken behavior? Example: On one session, listen for an incoming connection: % nc -l 5101 On another session, open an outgoing connection, then close the input: % nc 127.0.0.1 5101 ^D The session will not close. It doesn't seem to matter if the input is a terminal, file, pipe, or whatever else you can think of.
Dave Mischler wrote this message on Mon, Feb 10, 2014 at 19:16 -0500:> the 'nc' program doesn't seem to close the network connection anymore > when it reaches EOF. This worked fine in 9.x. Can somebody else > confirm this broken behavior? > > Example: > > On one session, listen for an incoming connection: > > % nc -l 5101 > > On another session, open an outgoing connection, then close the input: > > % nc 127.0.0.1 5101 > ^D > > The session will not close. It doesn't seem to matter if the input is a > terminal, file, pipe, or whatever else you can think of.I can't find the thread, but try adding the -N flag to nc: -N shutdown(2) the network socket after EOF on the input. Some servers require this to finish their work. For example, if you were POST'ing to an older HTTP/1.0 website w/o a content-length header, need this for the server to know that no more data is coming and to process the request and send you you're response.. nc was previously broken where a local EOF would shutdown the entire process instead of waiting for the remote side to finish sending... for example: cat << EOF | nc -N webserver 80 POST /cgi-bin/printenv HTTP/1.0 Host: webserver post=data&more=info EOF -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."
On Mon, Feb 10, 2014 at 07:16:11PM -0500, Dave Mischler wrote:> the 'nc' program doesn't seem to close the network connection anymore > when it reaches EOF. This worked fine in 9.x. Can somebody else > confirm this broken behavior? > > Example: > > On one session, listen for an incoming connection: > > % nc -l 5101 > > On another session, open an outgoing connection, then close the input: > > % nc 127.0.0.1 5101 > ^D > > The session will not close. It doesn't seem to matter if the input is a > terminal, file, pipe, or whatever else you can think of. >I think you want the '-N' flag. ------------------------------------------------------------------------ r249499 | delphij | 2013-04-15 01:31:59 -0400 (Mon, 15 Apr 2013) | 8 lines MFV r249496,249498. The most visible change is that we no longer shuts down the connection when stdin closes, by default. This matches Hobbit's original netcat and GNU netcat. Old behavior can be restored with the new -N flag. ------------------------------------------------------------------------ Glen -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 834 bytes Desc: not available URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140210/fae62a32/attachment.sig>