01 March 2010

playing with ruby

i started playing around with ruby recently.
one of the first things i figured i'd do is muck about with sockets.
it turns out that's brain dead easy with ruby, which i was happy to discover.
here's a quick and dirty whois client i whipped up as a way to learn the syntax etc.

require "socket"

rr = Array.new
whoisrv = "whois.arin.net"
port = "43"
qry = ""

s = TCPSocket.open(whoisrv, port)
while rr = s.gets
puts rr

No comments:

Post a Comment