No, it is correct. open_handle returns an opaque value that represents a remote file (or directory) handle. It just happens to be implemented as a string. To use it, you call sftp.read and sftp.write, passing the handle to it. (You can look at the synchronous.rb file in the examples subdirectory of the net-sftp distro for more examples of how to use open-handle). - Jamis On Sep 29, 2005, at 12:57 PM, Louis J Scoras wrote: > Does anyone know off the top of their head why the 'open_handle' > method > might return a string? > > require 'net/sftp' > > Net::SFTP.start('remotehost1') do |sftp| > sftp.put_file(foo, foobar) > sftp.open_handle(foobar) do |handle| > puts handle.inspect # => "\000\000\000\000" > puts handle.class # => "String" > puts data.read # => Raises error: method not defined > end > end > > It's not that the connection is bad, because the 'put_file' method > works > okay, and the file gets uploaded to the remote host just fine. > > Looking in the documentation leads me to believe that the call is > right. > Taking a cursory look through the source suggests that the return > should be > some object that delegates the IO operation to the > Net::SFTP::Operation > subclasses--if I'm reading it correctly :) > > -- > Lou >