From: Rayon Hunte Date: 2009-02-26T20:45:49+09:00 Subject: Re: problem with ruby telnet really need help now plz Rayon Hunte wrote: > Julian Leviston wrote: >> Can you connect normally? >> >> Blog: http://random8.zenunit.com/ >> Learn rails: http://sensei.zenunit.com/ > > > yes i can and catpute the file using cross talk. > i am trying to automate that process > here is the modifed code > still faling btw > > > # To change this template, choose Tools | Templates > # and open the template in the editor. > > require "rubygems" > require "net/telnet" > #================================ > > class Telnet > attr_accessor :host , :user ,:pass , :cmd ,:cmd2 ,:cmd3,:outfile,:ex > > def initialize > > end > > def telnet > begin > t = Net::Telnet::new( "Host" => @host,"Timeout" => 50000000, > "Telnetmode"=> true,"Waittime"=>2000,"Output_log"=> @outfile) > t.puts @user > t.puts @pass > t.puts @cmd > t.puts @cmd2 > t.puts @cmd3 > t.puts("logout") > f = File.open(@outfile, "w") > t.cmd("") > t.write("bottom") > f.close > end > > rescue StandardError => @ex > puts @ex > ensure > > t.puts("logout") > end > end > > the error message > An established connection was aborted by the software in your host > machine. > > c:/ruby/lib/ruby/1.8/net/telnet.rb:601:in `syswrite': An established > connection was aborted by the software in your host machine. > (Errno::ECONNABORTED) > > from c:/ruby/lib/ruby/1.8/net/telnet.rb:601:in `write' > > from c:/ruby/lib/ruby/1.8/net/telnet.rb:625:in `print' > > from c:/ruby/lib/ruby/1.8/net/telnet.rb:634:in `puts' > > from C:\Documents and > Settings\rhunte\Desktop\telnetmonster\lib/telnet.rb:34:in `telnet' > > from C:/Documents and > Settings/rhunte/Desktop/telnetmonster/lib/main.rb:51 i have made some more changes and here it is # To change this template, choose Tools | Templates # and open the template in the editor. require "rubygems" require "net/telnet" #================================ class Telnet attr_accessor :host , :user ,:pass , :cmd ,:cmd2 ,:cmd3,:outfile,:ex def initialize end def telnet begin t = Net::Telnet::new( "Host" => @host,"Timeout" => 200000, "Telnetmode"=> true,"Waittime"=>2000,"Output_log" => @outfile) t.puts @user t.puts @pass t.puts @cmd t.puts @cmd2 t.puts @cmd3 t.puts("logout") # File.open(@outfile,"w") t.cmd("") end rescue StandardError => @ex puts @ex ensure t.puts("logout") end end i am now using the telnet output_log to write the files bu i am still getting the error it runs for about a hour or so and then comes up with the error and not always that the same place. it's freaking me out -- Posted via http://www.ruby-forum.com/.