As far as I know, most WHOIS servers hang up on you after
each query, so you will have to reconnect explicitly.
You can recycle the socket object by forcing it to reconnect,
which should save you some overhead. Right now you're
creating a whole new socket object each time.
I'm not sure why the connected() function isn't operating
correctly, but it might not be a good indicator anyway.
Assume you're going to get ditched.