rsync & rcp

aslan at aslan at
Sat Nov 1 00:55:08 EST 2003

Thanks for your quick reply!

The tar solution isn't viable, since I'm writing java classes to allow
other java programs to transfer files via rsh/rexec. The only other
solution I can think of, other than closing the socket after every file,
is to emulate the rcp protocol and use rsh/rexec to call the rcp command
on the remote machine. That would mean I would have to use the binary
protocol you mention below to delimit files and describe metadata.

Is this binary protocol publicly available?


On Fri, 31 Oct 2003, Martin Pool wrote:

> On 30 Oct 2003, aslan at wrote:
> > 
> > I was hoping that since you guys are the authors to rsync that
> > you could answer a simple question for me.
> > 
> > I'm trying to transfer files via the rsh/rexec protocol by
> > remotely executing a cat command, i.e. "cat > foo.txt"
> > and then sending data through the socket to the stdin of the remote
> > process. This all works fine, except for the fact that I have to
> > close the socket to force and end of file. 
> > 
> > My question is, does rcp/rsync close a socket when it sends files
> > to signify and end of file? If not, how does it send multiple files
> > without closing the socket?
> It uses a binary protocol to delimit files and describe metadata such
> as their name and ownership.  As you say you cannot use the
> end-of-file mark more than once.  It is conceptually similar to a tar
> file.
> So if you wanted to send multiple files with just rsh, you could do
>   tar c mydir | ssh somehost tar x
> rsync at is a better forum for questions.
> --
> Martin

More information about the rsync mailing list