code to parse an array of hostnames into ips

Discussion in 'Programming General' started by jeltin, Dec 9, 2010.

code to parse an array of hostnames into ips
  1. Unread #1 - Dec 9, 2010 at 5:34 PM
  2. jeltin
    Joined:
    Nov 8, 2009
    Posts:
    26
    Referrals:
    0
    Sythe Gold:
    0

    jeltin Member

    code to parse an array of hostnames into ips

    so..ya, heres the code...it could probablly be simplified and sorry about no notes, mabey someone could do those things and post it to the thread
    Code:
    Dim arr() As String
            arr = Split(TextBox1.Text, Chr(13))
            Dim j() As IPAddress
            Dim x As Int32 = 0
            Dim f As String = ""
            Do Until x > arr.GetUpperBound(0)
                Try
                    Dim ipa As IPHostEntry = Dns.GetHostEntry(arr(x))
                    ReDim j(ipa.AddressList().GetUpperBound(0))
                    j = ipa.AddressList()
                    Dim y As Int32 = 0
                    Do Until y > j.GetUpperBound(0)
                        f = f & j(y).GetAddressBytes(0) & "." & j(y).GetAddressBytes(1) & "." & j(y).GetAddressBytes(2) & "." & j(y).GetAddressBytes(3) & ","
                        y = y + 1
                    Loop
                Catch ex As Exception
                    f = "Invalid host"
                End Try
                arr(x) = arr(x) & " -> " & f
                f = ""
                x = x + 1
            Loop
            MsgBox("done")
    
    :)
     
< Why am I getting this error? (python) | Tic Tac Toe help >

Users viewing this thread
1 guest


 
 
Adblock breaks this site