I am looking to transfer large amount of data through a socket from one machine to another. Usually I would just use scp or ssh, but this needs to all be done automatically, and setting up ssh keys cannot be done. I am trying to find a good way to do something link the following:

tar czf - <directory> | ssh <username>@<hostname> tar xzf -

Currently I am using sysread and syswrite to read and write to the socket and can transfer a single file at a time. However, I have directories that are 6 - 10 GB in size, so I was trying to reduce the transfer cost by tarring the directory to be sent. I could tar the directory prior to sending, but that seems foolish and I may run out of space on some machines if I do that. Is there a way to pipe tar into a socket, rather than to ssh? If so, can you please provide a small snippet. Thanks!


In reply to Perl - Socket and Data Compression by tptass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.