From: Andrew Stewart Date: 2006-11-09T03:16:39+09:00 Subject: Re: Net::SSH Data Stream Problem On 8 Nov 2006, at 17:56, Hugh Sasse wrote: > OK, given they're both unices, that figures... I'd then read and > write in smaller chunks. I don't do enough deep networking to know > what packet sizes are sensible, but... > > --------------------------------------------------------------- > IO#write > ios.write(string) => integer > ---------------------------------------------------------------------- > -- > Writes the given string to _ios_. The stream must be opened for > writing. If the argument is not a string, it will be converted > to a > string using +to_s+. Returns the number of bytes written. > [...] > > ...probably a good idea to check the return value. And for f.read. I changed this: open(source_path) { |f| stdin.write f.read } To this: open(source_path) { |f| x = f.read puts "x: #{x.length}" result = stdin.write x puts "result: #{result}" } And it told me that x is the size of my file, so f.read is reading in the entire file. The stdin object is an instance of SSHStdinPipe. The documentation for its write method [1] says: "Write the given data as channel data to the underlying channel." I.e. it doesn't mention anything about size limits. But clearly there is a size limit somewhere and the 'stdin.write data' method must be the line which hits it. I dug into the source but got a bit confused. Any more ideas? Thanks, Andy [1] http://net-ssh.rubyforge.org/api/classes/Net/SSH/Service/Process/ POpen3Manager/SSHStdinPipe.html