tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 9.1 nc: two issues



>> I want the nc process to exit immediately (after draining all
>> output, if any), instead of waiting for more input (or EOF) on
>> stdin.

>> Is there a way to get this?  I don't see one in the manpage, but I
>> certainly could have missed something.

> All versions of nc I know of, do exactly this by default.

I have no problem with either behaviour as a default - indeed, my own
nc defaults to this behaviour too.  What bothers me is the (apparent)
lack of a way to get the other behaviour.  In this case, of course, the
apparently-unobtainable behaviour is the one I want.

For most use cases I'd just use my own nc (which does have an option to
get the behaviour I want here), porting it to the new system if
necessary.  For this use case it would be preferable to use
stock-system tools.

> I think that it's because shutdown(2) != close(2), and maybe it's
> because there could still be more output coming from the socket
> "soon"

Well, in this case, what I want is a way to say "exit as soon as you've
received EOF on the socket and pushed all data received before that to
stdout, even if you haven't received EOF on stdin".

Yes, for other use cases, there could be more data coming on stdin
which could potentially be sent over the socket.  That's why having
that behaviour is useful.  But for *this* use case, it's actually a
problem.

> So, I wind up usually using "-w 10"

Not suitable for this use case; there should be no timeout whenever the
connection is still up in both directions.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index