--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Adds an IO object for the event loop to listen to. If a callback is given, it will be invoked when the io is ready to be read, otherwise, the io will merely have its #fill method invoked."
- !ruby/struct:SM::Flow::P 
  body: "Any <tt>io</tt> value passed to this method <em>must</em> have mixed into it the Net::SSH::BufferedIo functionality, typically by calling #extend on the object."
- !ruby/struct:SM::Flow::P 
  body: "The following example executes a process on the remote server, opens a socket to somewhere, and then pipes data from that socket to the remote process' stdin stream:"
- !ruby/struct:SM::Flow::VERB 
  body: "  channel = ssh.open_channel do |ch|\n    ch.exec &quot;/some/process/that/wants/input&quot; do |ch, success|\n      abort &quot;can't execute!&quot; unless success\n\n      io = TCPSocket.new(somewhere, port)\n      io.extend(Net::SSH::BufferedIo)\n      ssh.listen_to(io)\n\n      ch.on_process do\n        if io.available &gt; 0\n          ch.send_data(io.read_available)\n        end\n      end\n\n      ch.on_close do\n        ssh.stop_listening_to(io)\n        io.close\n      end\n    end\n  end\n\n  channel.wait\n"
full_name: Net::SSH::Connection::Session#listen_to
is_singleton: false
name: listen_to
params: (io, &callback)
visibility: public
