`waitfor': timed out while waiting for more data error on ruby telnet connection

Hi,

i tried with below commands to telnet connection to the device

require ‘net/telnet’
con = Net::Telnet::new(“Host”=> ‘X.X.X.X’,“Port”=> XXXX, “Prompt”=>
/User:/, “Timeout”=> 240,“Output_log”=>“output_log.log”, “Dump_log”=>
“dump_log.log”) { |c| print c }
con.cmd(“String” => “admin”,“Match” => /Password:/,“Timeout” => 180) {
|c| print c }
con.cmd(“String” => “mypass”,“Match” => /(#{$prompt}) >/,“Timeout”
=> 60) { |c| print c }
con.cmd(“String” => “show run”,“Match” => /(#{$prompt})
>/,“Timeout” => 60) { |c| print c }
con.close

I am able to connect with the console at some times. but some times i
got error like

C:/Ruby193/lib/ruby/1.9.1/net/telnet.rb:558:in waitfor': timed out while waiting for more data (Timeout::Error) from C:/Ruby193/lib/ruby/1.9.1/net/telnet.rb:697:incmd’
from C:/Documents and Settings/Administrator/Desktop/rub.rb:3:in
<top (required)>' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inload’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
block in load_spec_files' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inmap’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
load_spec_files' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:inrun’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in
run' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:inblock in autorun’

If anyone have solution to fix that issue.

Thanks in advance.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs