# File lib/net/ssh/service/forward/remote-network-handler.rb, line 40 def on_open( channel, c_addr, c_port, o_addr, o_port ) @client = TCPSocket.new( @local_host, @local_port ) Thread.new do begin loop do break if channel[:eof] data = "" while IO.select([@client],nil,nil,0.01) data << @client.recv(@block_size) end channel.send_data data unless data.empty? end rescue Exception => e @log.error "error while forwarding remote port: " + "#{e.class}: #{e.message}\n " + e.backtrace.join( "\n " ) ensure channel.close end end end