Click here to Skip to main content
Click here to Skip to main content

Tagged as

Whats My IP Address ?

, 13 Sep 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Different Method(s) to Find IP Address?
Method 1
Imports System.Net

Dim _HostName As String = Dns.GetHostName

Dim _IPHostEntry As IPHostEntry = Dns.GetHostByName(_HostName)
For Each _IP As IPAddress In _IPHostEntry.AddressList
Method 2
Imports System.IO
Imports System.Text


Private Function GetInternetIPAddress() As String
Dim _ObjReq As HttpWebRequest = WebRequest.Create("")
Dim _ObjRes As HttpWebResponse = _ObjReq.GetResponse()
Dim _ObjStream As Stream = _ObjRes.GetResponseStream()
Dim _ObjSR As StreamReader = New StreamReader(_ObjStream)
Return _ObjSR.ReadToEnd()
Catch ex As Exception
   Return String.Empty
End Try
End Function


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Koshy Panicker John
Software Developer (Senior)
India India
No Biography provided

Comments and Discussions

QuestionThanks so much Pinmemberafpfdv5-Apr-13 18:59 
General doesn't work ... Pinmemberkiquenet AE21-Nov-11 21:30 
GeneralReason for my vote of 4 Thanks for the Code lines. PinmemberMember 432084427-Sep-11 9:24 
GeneralReason for my vote of 4 Thanks. PinmemberMember 432084427-Sep-11 9:15 
GeneralReason for my vote of 3 good one PinmemberHemant K Mahajan27-Sep-11 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150129.1 | Last Updated 13 Sep 2011
Article Copyright 2011 by Koshy Panicker John
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid