Domain Name Availability

jason2li

Member
Joined
Nov 18, 2005
Messages
22
Location
St. Louis, MO
Programming Experience
5-10

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,471
Location
Norway
Programming Experience
10+
You can for example use IANA Root Zone Database to find who is keeping track of each top domain, each of these have a whois service you can access with a socket on port 43. The information is free for legitimate usage, ie simple lookups for reasons specified in guidelines. Whois is an easy protocol; just send a terminated domain name string and read the response. Example:
VB.NET:
Function Whois(ByVal db As String, ByVal domain As String) As String
    Using tcp As New Net.Sockets.TcpClient(db, 43)
        Dim q() As Byte = System.Text.Encoding.ASCII.GetBytes(domain & vbNewLine)
        tcp.GetStream.Write(q, 0, q.Length)
        Using reader As New IO.StreamReader(tcp.GetStream, System.Text.Encoding.ASCII)
            Return reader.ReadToEnd
        End Using
    End Using
End Function
VB.NET:
Dim txt As String = Whois("whois.norid.no", "akajieifcvnvj.no")
 
Top Bottom