[Tutor] Socket connection
dyoo at hkn.eecs.berkeley.edu
Mon Dec 5 02:03:13 CET 2005
> I need to get some whois-info from whois.ripe.net. I have been able to
> connect and get the info that I need, but I would like to know what is
> the most 'polite' way of doing so. I need to do quite a few whois
> lookups (from my server logs) and don't want to risk creating more
> hassle for their server than necessary. So, what I would like to know,
> is what is the best way of doing lots of requests?
It's really specific to the protocol: a protocol will define if it's ok or
not to send multiple requests per connection. According to RFC 3912:
here is their high-level overview of the WHOIS protocol:
2. Protocol Specification
A WHOIS server listens on TCP port 43 for requests from WHOIS
clients. The WHOIS client makes a text request to the WHOIS server,
then the WHOIS server replies with text content. All requests are
terminated with ASCII CR and then ASCII LF. The response might
contain more than one line of text, so the presence of ASCII CR or
ASCII LF characters does not indicate the end of the response. The
WHOIS server closes its connection as soon as the output is finished.
The closed TCP connection is the indication to the client that the
response has been received.
So unfortunately it does look like you'll have to reestablish the
connection after each request: the whois protocol as defined here doesn't
appear to allow multiple requests per connection.
Hope this helps!
More information about the Tutor