Jump to content

  •  

  • iBotModz CBox


    Photo

    (VB.NET) Get IP Addresses


    • Please log in to reply
    9 replies to this topic

    #1 Dark Slipstream

    Dark Slipstream

      Blue Shadowz Owner

    • Members+

    • 2,829 posts
    • Joined: 19-April 08
    • Gender:Male
    • Location:Canada, ON

    Posted 11 May 2009 - 08:54 PM

    -------------
    
     External IP
    
    -------------
    
    
    
    Try
    
     Dim WC As New System.Net.WebClient
    
     MsgBox(System.Text.Encoding.ASCII.GetString(WC.DownloadData("http://www.swlink.net/~styma/REMOTE_ADDR.shtml")))
    
     MsgBox(System.Text.Encoding.ASCII.GetString(WC.DownloadData("http://whatismyip.com/automation/n09230945.asp")))
    
     WC.Dispose()
    
    Catch
    
     'Display Error Message
    
    End Try
    
    
    
    
    
    -------------
    
     Internal IP
    
    -------------
    
    
    
    Try
    
     Dim ipEntry As System.Net.IPHostEntry = Net.Dns.GetHostEntry(Environment.MachineName)
    
     Dim IpAddr As System.Net.IPAddress() = ipEntry.AddressList
    
     MsgBox(IpAddr(0).ToString())
    
    Catch
    
     'Display Error Message
    
    End Try
    
    
    
    
    
    ---------------
    
     Address to IP
    
    ---------------
    
    
    
    If Not T2.Text = "" Then
    
     Try
    
     ipE = Dns.GetHostEntry(T2.Text)
    
     Catch
    
     MessageBoxEx.Show("Site does not exist!", "DoS", MessageBoxButtons.OK, MessageBoxIcon.Information)
    
     End Try
    
    
    
     Dim IpA() As IPAddress = ipE.AddressList
    
     TX.Text = IpA(0).ToString
    
    End If

    Edited by iBotPeaches, 09 September 2009 - 05:42 AM.


    #2 yungbol

    yungbol

      Firmware Expert

    • Global Mods

    • 1,461 posts
    • Joined: 09-April 08
    • Gender:Male
    • Location:Philly

    Posted 11 May 2009 - 08:55 PM

    I made one of these a while ago (posted in General Discussion a long time back) and used the TCP connection way. I forget exactly though.

    #3 DEEhunter

    DEEhunter

      Corporal Grade 2

    • Members+

    • 228 posts
    • Joined: 19-June 08

    Posted 11 May 2009 - 08:56 PM

    External IP method is mediocre.

    #4 Joe Walls

    Joe Walls

      Corporal Grade 2

    • Members+

    • 258 posts
    • Joined: 12-February 09
    • Location:United States (WA)

    Posted 11 May 2009 - 08:57 PM

    I still don't know what to do with these as far as buttons labels etc. and where to paste them :\

    #5 Dark Slipstream

    Dark Slipstream

      Blue Shadowz Owner

    • Members+

    • 2,829 posts
    • Joined: 19-April 08
    • Gender:Male
    • Location:Canada, ON

    Posted 11 May 2009 - 08:57 PM

    Only way I knew how to do it.

    You can dump the output of ipconfig in cmd, and display it that way too, but people won't understand it.

    #6 T3A guy

    T3A guy

      :)

    • Members+

    • 1,191 posts
    • Joined: 09-May 08
    • Gender:Male

    Posted 11 May 2009 - 08:57 PM

    Is nothing the same as ""?

    #7 yungbol

    yungbol

      Firmware Expert

    • Global Mods

    • 1,461 posts
    • Joined: 09-April 08
    • Gender:Male
    • Location:Philly

    Posted 11 May 2009 - 08:58 PM

    Only way I knew how to do it.

    You can dump the output of ipconfig in cmd, and display it that way too, but people won't understand it.


    Do a tutorial on that ;) I wanted to look up displaying cmd outputs, got too lazy...

    #8 Dark Slipstream

    Dark Slipstream

      Blue Shadowz Owner

    • Members+

    • 2,829 posts
    • Joined: 19-April 08
    • Gender:Male
    • Location:Canada, ON

    Posted 11 May 2009 - 08:58 PM

    Yes, but it's alot cleaner. "" gives it a null char. nothing is exactly what it is, "Nothing".

    #9 Joe Walls

    Joe Walls

      Corporal Grade 2

    • Members+

    • 258 posts
    • Joined: 12-February 09
    • Location:United States (WA)

    Posted 11 May 2009 - 09:00 PM

    Someone reply to my post?

    #10 yungbol

    yungbol

      Firmware Expert

    • Global Mods

    • 1,461 posts
    • Joined: 09-April 08
    • Gender:Male
    • Location:Philly

    Posted 11 May 2009 - 09:01 PM

    You make it a sub, then to use it, label1.Text = InternalIP.