Well, ECONNABORTED is unusual, and is probably some sort of firewalling problem. What happens if you are on the same machine as your Ruby program and telnet to the same target host? Try running tcpdump -i eth0 -n -s0 -X host x.x.x.x to look at the traffic to/from host x.x.x.x. (Or Wireshark if this is a Windows box). I can see a few other problems. > t = Net::Telnet::new( "Host" => @host,"Timeout" => 200000, > "Telnetmode"=> true,"Waittime"=>2000) These timeouts are in seconds, not milliseconds > t.puts @user > t.puts @pass > t.puts @cmd > t.puts @cmd2 > t.puts @cmd3 > t.puts("logout") You are blasting all these strings to the device, without waiting for prompts first. If t.login doesn't work for you, do it by hand: log = lambda { |c| STDERR.print c } t.waitfor(/ogin:/, &log) t.puts @user t.waitfor(/assword:/, &log) > File.open(@outfile,"w") Here you open the file, but discard the file handle completely, so it will be closed again when the garbage collector next runs. > t.cmd("") do |data| print data > File.open(@outfile, "a") { |i| > i.print(data) > } > end This re-opens the outfile for every response or part-response received from the target device. Much better to open it once, e.g. log = nil File.open(@outfile,"a") do |f| log = lambda { |c| STDERR.print c f.print c } end Another less painful way to get logging is to use the Output_log option, e.g. t = Net::Telnet.new( "Host" => @host, "Output_log" => @outfile) or t = Net::Telnet.new( "Host" => @host, "Output_log" => "/dev/stderr") (but this won't write to both, of course) -- Posted via http://www.ruby-forum.com/.