• Log in or sign up for an account here: https://www.sythe.org/login

code to parse an array of hostnames into ips

jeltin

Member
Joined
Nov 8, 2009
Sythe Gold
0
Messages
26
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")
:)
 
Runescape Gamblingrunescape gambling
Back
Top