* Wesley J. Landaker ([EMAIL PROTECTED]) wrote:
> I'm not the maintainer, but use netcat a lot. Here are some comments:

Hi Wesley,
   Thanks for the reply.

> On Saturday 14 May 2005 10:55, Dr. David Alan Gilbert wrote:
> >   I'm trying to shovel a large amount of data (800GB) between two
> > machines, so have a pair of tar's running over netcat as follows:
> >
> > on the source:
> >
> >   tar -clf- . | nc destination 6666
> 
> First of all, did only one, or both of these commands actually result in a 
> message from your shell telling you it was waiting for stdin? It really 
> makes a difference:
> 
> If this one was looking for input, it would have had to have been tar, not 
> netcat, as netcat's stdin is tied to tar's stdout, so it couldn't have 
> blocked the shell; only tar could have. Did this one say that the program 
> was waiting for input, or was it just the other one below?

It was only the nc -l  on the destination machine that was waiting for
input.

> > on the destination:
> >
> >   nc -l -p 6666 | tar -xpf -
> >
> > I had these running in a background'ed nohup and after a while the
> > copying stopped and bash told me that the backgrounded destination
> > package had stopped waiting for input;  sure enough I 'fg'd
> > it and hit return a few times and it carried on its way.
> 
> I'm not sure why netcat would be blocking on input here (it only does 
> non-blocking reads in it's main I/O function (readwrite), but if this 
> happened to you on this command line, that is where the bug mostly like 
> lives. =)

Indeed - I also strace'd it at one point when it hung and saw it waiting
on a read of fd 0 which was still the terminal I'd run it from.

> There is an easy workaround for either case (bug or not), though: when you 
> run that command, you're leaving netcat's stdio hooked to your terminal. 
> I'd suggest tying it's stdin off to /dev/null, with something like:

Indeed - (or perhaps from a 'yes' if it really wants the carriage
return.) - but it was already 50GB in and I'd hoped it wouldn't happen
again.

Dave

 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    | Running GNU/Linux on Alpha,68K| Happy  \ 
\ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to