-
-
Save jots/422ced81c65d3c32ca9047751afadb73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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