From: Julian Leviston Date: 2009-02-26T07:08:25+09:00 Subject: Re: problem with ruby telnet really need help now plz Can you connect normally? Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 26/02/2009, at 1:12 AM, Rayon Hunte wrote: > i have been using ruby telnet class to run a dump in a northtel switch > and capture it to a file. > here is the error . > Renameing GSMFILES > > Download GPRS > > Download BSVC > > Download SSOP > > 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:30:in `telnet' > > from C:/Documents and > Settings/rhunte/Desktop/telnetmonster/lib/main.rb:63 > > > > and here the class code: > > 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) > t.puts @user > t.puts @pass > t.puts @cmd > t.puts @cmd2 > t.puts @cmd3 > t.puts("logout") > File.open(@outfile,"w") > t.cmd("") do |data| print data > File.open(@outfile, "a") { |i| > i.print(data) > } > end > rescue StandardError => @ex > puts @ex > end > ensure > t.puts("logout") > end > > > end > -- > Posted via http://www.ruby-forum.com/. >