Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2014 23:55
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/usr/bin/env ruby
require 'socket'
require 'thread'
threads = Array.new
ports = [*(1..1024)]
port.each do port
threads << Thread.new(port) do |p|
begin
t = TCPSocket.new("myserver.net", p).close
puts "PORT #{p} OPEN"
rescue
puts "PORT #{p} CLOSED"
end
end
end
threads.each(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment