vb.net get my ip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gangreen
    New Member
    • Feb 2008
    • 98

    vb.net get my ip

    I want to get my ip.

    When i try to do this:

    MsgBox(System.N et.Dns.GetHostB yName(System.Ne t.Dns.GetHostNa me).AddressList (0).ToString)

    I get the ip within my LAN.

    When i surf to http://whatismyip.com/ I get the ip I want to get in my vb.net program.

    How can I do this?
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    This may not be the direction were wanting to take, but WhatIsMyIP has an automation page. You could do an HttpWebRequest, and use the response, like this:

    [code=vbnet]
    Dim ipReq As HttpWebRequest
    ipReq = WebRequest.Crea te("http://whatismyip.com/automation/n09230945.asp")
    Dim sr As New System.IO.Strea mReader(ipReq.G etResponse().Ge tResponseStream ())
    Dim ipAdd As String
    ipAdd = sr.ReadToEnd()
    [/code]

    For some reason, it seems like the code tags are screwing up a bit. There shouldn't be a space on line 3 at the .GetResponseStr eam())

    Originally posted by Gangreen
    I want to get my ip.

    When i try to do this:

    MsgBox(System.N et.Dns.GetHostB yName(System.Ne t.Dns.GetHostNa me).AddressList (0).ToString)

    I get the ip within my LAN.

    When i surf to http://whatismyip.com/ I get the ip I want to get in my vb.net program.

    How can I do this?
    Last edited by Curtis Rutland; May 25 '08, 09:30 PM. Reason: added code

    Comment

    • Gangreen
      New Member
      • Feb 2008
      • 98

      #3
      ok, I have a server to which clients can connect.

      I would like to know how I can find the external ip (in the server) of such a client, without the use of such an internet page.

      Thx

      Comment

      Working...