Search code examples
.netc++-cliwhois

Detail information about Whois server reply


Background

Today I want to test how WHOIS query and response protocol works, I read some information on Wiki and start writing code. After 5 minutes I have complete and working code, but I have some questions what I want to share with you.

Code

Here is a simple code that makes requests to the given whois.iana.org url and get replies from it. For example here I make a request for vitobrothersoft.com and get reply. Now the main question is not how this all works it is understandable for me. While Testing this part of code I change request domains whois.iana.org, com.whois-servers.net, whois.verisign-grs.com and in some ways the replies were same in some ways no. You can see example of reply bellow.

#include "stdafx.h"

using namespace System;

#define PORT 43

int main(array<System::String ^> ^args)
{
    System::Net::Sockets::TcpClient^ client = gcnew System::Net::Sockets::TcpClient("whois.iana.org", PORT);

    if( client != nullptr ) {

        System::String^ formatedDomain = "vitobrothersoft.com" + "\r\n";
        System::Text::Encoding^ ascii  = System::Text::Encoding::ASCII;
        array<System::Byte>^ byteUrl   = ascii->GetBytes(formatedDomain);

        System::IO::Stream^ stream = client->GetStream();

        // Write formatted URL to stream.
        stream->Write( byteUrl, 0, formatedDomain->Length );

        System::IO::StreamReader^ streamReader = gcnew System::IO::StreamReader( stream, System::Text::Encoding::ASCII );

        Console::Write( streamReader->ReadToEnd( ) );
    }
}

Reply Example

[Querying com.whois-servers.net]
[com.whois-servers.net]

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: EXAMPLE.COM
   Registrar: RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY
   Whois Server: whois.iana.org
   Referral URL: http://res-dom.iana.org
   Name Server: A.IANA-SERVERS.NET
   Name Server: B.IANA-SERVERS.NET
   Status: clientDeleteProhibited
   Status: clientTransferProhibited
   Status: clientUpdateProhibited
   Updated Date: 26-mar-2004
   Creation Date: 14-aug-1995
   Expiration Date: 13-aug-2011

>>> Last update of whois database: Tue, 17 Aug 2010 02:23:52 UTC <<<

Question

I want to know

  1. Whats the difference between different services (urls) ?
  2. How many values can come for Status (clientDeleteProhibited, clientTransferProhibited, clientUpdateProhibited) ?
  3. I Need full information about every field of reply text

Solution

  • Referance