Results 1 to 3 of 3

Thread: VB6 very simple WHOIS app

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    186

    Lightbulb VB6 very simple WHOIS app

    Just posting it in case if anyone needs it. Please do post replies if you have any suggestions:
    Code:
    Option Explicit
    'drop 2 text boxes, a command button, and a winsock control on your form
    Private sWinsockCommand As String
    Private sDataIn As String
    Private sDataBuff As String
    
    Private Sub Command1_Click()
    'whois ("domain.com")
    whois (Text1.Text)
    End Sub
    
    Private Sub Form_Load()
    Winsock1.Close
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    Winsock1.Close
    End Sub
    
    Private Sub Winsock1_Close()
       If Winsock1.State = sckClosing Then
          Winsock1.Close
          Text2.Text = ""
          sDataBuff = Replace(sDataBuff, vbLf, vbCrLf)
          Text2.Text = sDataBuff
       End If
    End Sub
    
    Private Sub Winsock1_Connect()
       If Winsock1.State = sckConnected Then
          Winsock1.SendData sWinsockCommand & vbCrLf
       End If
    End Sub
    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
       Winsock1.GetData sDataIn
       sDataBuff = sDataBuff & sDataIn
    End Sub
    
    Private Function whois(domain As String)
       Dim sServer As String
       sDataIn = ""
       sDataBuff = ""
       If Right(Text1.Text, 4) = ".com" Then sServer = "rs.internic.net"
       If Right(Text1.Text, 4) = ".net" Then sServer = "rs.internic.net"
       If Right(Text1.Text, 4) = ".org" Then sServer = "whois.publicinterestregistry.net"
       If Right(Text1.Text, 4) = ".edu" Then sServer = "whois.educause.net"
       If Right(Text1.Text, 4) = ".gov" Then sServer = "whois.nic.gov"
       If Right(Text1.Text, 5) = ".info" Then sServer = "whois.afilias.info"
       If Right(Text1.Text, 3) = ".ru" Then sServer = "whois.ripn.ru"
       sWinsockCommand = domain
       With Winsock1
          .Close
          .LocalPort = 0
          .Connect sServer, 43
          whois = .State = sckResolvingHost
       End With
    End Function

  2. #2
    Junior Member
    Join Date
    Sep 2007
    Posts
    29

    Re: VB6 very simple WHOIS app

    This probably belongs in the CodeBank forum.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: VB6 very simple WHOIS app

    Moved to the CodeBank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width