Public Shared Function tcp(ByVal q, ByVal server, ByVal port, ByVal timeout)
Dim tcpc As System.Net.Sockets.TcpClient = New System.Net.Sockets.TcpClient
tcpc.NoDelay = False
Try
tcpc.Connect(server, port)
Dim arrDomain As Byte() = System.Text.Encoding.ASCII.GetBytes(CStr(q).ToCharArray())
Dim s As System.IO.Stream = tcpc.GetStream()
s.Write(arrDomain, 0, CStr(q).Length())
s.Flush()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(tcpc.GetStream(), System.Text.Encoding.ASCII)
Dim strLine As String = ""
tcpc.ReceiveTimeout = timeout * 1000
Dim qx As String
qx = sr.ReadToEnd()
tcpc.Close()
tcpc = Nothing
s.Close()
s = Nothing
sr.Close()
sr = Nothing
Return qx
Catch e As Exception
'Console.WriteLine(e.ToString())
Return -1
End Try
End Function
Public Shared Function Who(ByVal domain As String)
Dim q = "" & domain & "" & vbCrLf
Dim whoisserver As String
If (domain.indexOf(".com") > -1) Then
whoisserver = "whois.crsnic.net"
ElseIf (domain.indexOf(".net") > -1) Then
whoisserver = "whois.crsnic.net"
ElseIf (domain.indexOf(".org") > -1) Then
whoisserver = "whois.opensrs.net"
ElseIf (domain.indexOf(".biz") > -1) Then
whoisserver = "whois.nic.biz"
ElseIf (domain.indexOf(".info") > -1) Then
whoisserver = "whois.nic.info"
ElseIf (domain.indexOf(".us") > -1) Then
whoisserver = "whois.nic.us"
End If
return tcp(q, whoisserver, 43, 10)
End Function