http://www.anta.net/misc/telnet-troubleshooting/whois.shtml shows that we can get whois server using telnet

However, webclient uses get and http protocol.

So how to get whois via vb.net then?

Some software like domainpunch can get tons of domain info. However, they can't possibly just query whois server because most of which are rate limited.

Maybe they query tons of whois server.

Or how?

有帮助吗?

解决方案

A simple TcpClient will do. WhoIs is a very simple protocol: you just connect and send the query followed by \r\n.

Example:

Private Sub Main()
    Dim data = System.Text.Encoding.ASCII.GetBytes("stackoverflow.com" & Microsoft.VisualBasic.vbCr & Microsoft.VisualBasic.vbLf)
    Using client = New TcpClient("whois.name.com", 43),
        stream = client.GetStream()
        stream.Write(data, 0, data.Length)

        data = New Byte(255) {}
        Dim responseData = String.Empty
        Dim read = stream.Read(data, 0, data.Length)
        While read > 0
            responseData = System.Text.Encoding.ASCII.GetString(data, 0, read)
            Console.Write(responseData)
            read = stream.Read(data, 0, data.Length)
        End While
    End Using
End Sub

Output:

__   _                             ____                
| \ | | __ _ _ __ ___   ___       / ___|___  _ __ ___  
|  \| |/ _` | '_ ` _ \ / _ \     | |   / _ \| '_ ` _ \ 
| |\  | (_| | | | | | |  __/  _  | |__| (_) | | | | | |
|_| \_|\__,_|_| |_| |_|\___| (_)  \____\___/|_| |_| |_|
On a first name basis with the rest of the world.


Get your <a href="http://www.name.com">domains</a> at Name.com.


Domain Name:     stackoverflow.com
Registrar:       Name.com LLC

Expiration Date: 2015-12-26 19:18:07
Creation Date:   2003-12-26 19:18:07

Name Servers:
  ns1.serverfault.com
  ns2.serverfault.com

REGISTRANT CONTACT INFO
Stack Exchange, Inc.
Sysadmin Team
1 Exchange Plaza
Floor 26
New York
NY
10006
US
Phone:         +1.2122328280
Email Address: sysadmin-team@stackoverflow.com

ADMINISTRATIVE CONTACT INFO
Stack Exchange, Inc.
Sysadmin Team
1 Exchange Plaza
Floor 26
New York
NY
10006
US
Phone:         +1.2122328280
Email Address: sysadmin-team@stackoverflow.com

TECHNICAL CONTACT INFO
Stack Exchange, Inc.
Sysadmin Team
1 Exchange Plaza
Floor 26
New York
NY
10006
US
Phone:         +1.2122328280
Email Address: sysadmin-team@stackoverflow.com

BILLING CONTACT INFO
Stack Exchange, Inc.
Sysadmin Team
1 Exchange Plaza
Floor 26
New York
NY
10006
US
Phone:         +1.2122328280
Email Address: sysadmin-team@stackoverflow.com

Timestamp: 1383039360.9081

The Data in the Name.com LLC WHOIS database is provided by Name.com LLC for information purposes, and to assist persons in obtaining information about or related to a domain name registration record.  Name.com LLC does not guarantee its accuracy.  By submitting a WHOIS query, you agree that you will use this Data only for lawful purposes and that, under no circumstances will you use this Data to:  (1) allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via e-mail (spam); or (2) enable high volume, automated, electronic processes that apply to Name.com LLC (or its systems). Name.com LLC reserves the right to modify these terms at any time.  By submitting this query, you agree to abide by this policy.

Cached on: 2013-10-29T03:36:00-06:00
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top