Skip to content

Instantly share code, notes, and snippets.

@jots
Created December 10, 2016 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jots/422ced81c65d3c32ca9047751afadb73 to your computer and use it in GitHub Desktop.
Save jots/422ced81c65d3c32ca9047751afadb73 to your computer and use it in GitHub Desktop.
require "socket"
class Whois
def initialize
@server = "whois.crsnic.net"
end
def do_whois(domain)
buf = ""
s = TCPSocket.new(@server, 43)
s.write "=#{domain}\r\n".to_slice
while line = s.gets
buf += line
end
s.close
return buf
end
end
nb = Whois.new
1.upto(10) do |x|
spawn do
puts nb.do_whois("a#{x}.com")
end
end
Fiber.yield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment