Re: DD -> Netcat NT Imaging

From: Valdis.Kletnieksat_private
Date: Fri Sep 13 2002 - 08:57:17 PDT

  • Next message: Valdis.Kletnieksat_private: "Re: DD -> Netcat NT Imaging"

    On Fri, 13 Sep 2002 15:46:26 +0200, Volker Tanger said:
    > 
    > Slow-Server:  dd if=/dev/hda | bzip2 -c | nc -p 12345 -l
    > Fast-Client:  nc SERVER 12345 > image.bz2
    ...
    
    > Slow-Server:  cat image.bz2 | nc CLIENT 12345
    > Fast-Client:  nc -p 12345 -l | bzip2 -c > image.bz2
    > 
    > 
    > This way there always is data "waiting at the door" to be received. In 
    > the first sample the nc client is "torn" between the slow server and the 
    > speeding local HD. This setup simply is calling for timeouts.
    
    Ahh.. I see now.  I'd always used "-l" on the "catching" side of the data.
    I suspect that it doesn't really matter *which* side does the -l, what
    is mattering is when/where you do the 'bzip'.  I suspect what you're *really*
    seeing in the first case is netcat timing out because bzip2 has hit a *long*
    (multi-gig) string of zeros and is compressing it and failing to output enough
    to make another block of data to send before the default "-w" value expires.
    
    In the second case, when you hit the LOOOONG run of zeros, you'll have a long
    stream of zeros to transmit and compress on the "catch" side of the pipe - and
    any slowness *there* will cause the pipe into bzip2 to block, which will
    eventually cause a TCP window size drop to be sent to the sending system,
    and everything will Just Work.
    -- 
    				Valdis Kletnieks
    				Computer Systems Senior Engineer
    				Virginia Tech
    
    
    
    



    This archive was generated by hypermail 2b30 : Fri Sep 13 2002 - 09:08:43 PDT