Programalama > VISUAL BASIC.NET

Etiketler: whois, tcpclient

Ort. 0
Puan ver:
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


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.