Hmmm, what platform are you running it from? Just ran in from Mac OS 10.5.8
with Ruby 1.8.7 and it ran fine (ruby 1.8.7 (2009-06-12 patchlevel 174)
[i686-darwin9.7.0]).

Maybe a tcp stack implementation difference between platforms? I did notice
you had some addresses that have colons in them (e.g. 123456:201.92.93).
Still handled fine on my machine but maybe not on others. Anyone else?

On Wed, May 12, 2010 at 8:49 AM, Sajjad Po <magicc0d3r / gmail.com> wrote:

> hi.
>
> i wrote a little script . (Mass IP Pinger)
> But I got an error :-s
>
> Error :
> ---
> /usr/lib/ruby/1.8/timeout.rb:60:in `timeout': execution expired  from
> /usr/lib/ruby/1.8/ping.rb:46:in `pingecho'
>  from a.rb:27
>  from a.rb:26:in `each'
>  from a.rb:26
> ---
> and my script :
> ----
> #!/usr/bin/env ruby
>
> #Mass IP Pinger By MagicCoder (MagicC0d3r / gmail.com)
> #    www.magiccoder.ir
> #-f = File
> #-t = Time Out  #Defualt = 0.5
> #-p = Port  #Defualt = 80
> #
> #sample : ruby magic.rb -f ip.txt -t 1 -p 22
> #sample : ruby magic.rb -f ip.txt
>
> require 'ping'
>
> time_out = 0.5 #Defualt
> port = 80 #Defualt
>
> length = 0
> while (length < ARGV.length)
>  file = ARGV[length+1] if ARGV[length]  == '-f'
>  time_out = ARGV[length+1] if ARGV[length]  == '-t'
>  port = ARGV[length+1] if ARGV[length]  == '-p'
>  length += 1
> end
>
> if (file != nil)
>  File.open(file).each do |line|
>    result = Ping.pingecho(line.scan(/\d+.\d+.\d+.\d+/).to_s,
> time_out.to_f , port.to_i)
>    if(result == true )
>      puts line.scan(/\d+.\d+.\d+.\d+/).to_s+"\t\t\tIs Up"
>    else
>      puts line.scan(/\d+.\d+.\d+.\d+/).to_s+"\t\t\tIs Down"
>    end
>  end
>  puts "Finish ..."
> else
>    puts "\n\nMass IP Pinger By MagicCoder
> (MagicC0d3r / gmail.com)\n\t\twww.magiccoder.ir"
>    puts "\n-f = File\n-t = Time Out\t#Defualt = 0.5\n-p =
> Port\t#Defualt = 80"
>    puts "\nsample : ruby magic.rb -f ip.txt -t 1 -p 22"
>    puts "sample : ruby magic.rb -f ip.txt\n\n"
> end
> ----
>
> sh$ ruby magic.rb -f list.txt -t 0.5 -p 22
> for sample Attached list
>
>
> Thank you .
>
> Attachments:
> http://www.ruby-forum.com/attachment/4722/list.txt
>
> --
> Posted via http://www.ruby-forum.com/.
>
>