How to get physical ip address

You can talk about VB programming here

Postby NinjaCoder » Thu Jan 18, 2007 12:26 pm


Ok i was bored so i decided to make a prog for this and since the attachment from zarabyte seems to have dissappeared i am posting the prog with the source code so people can learn. if u are not connected to the internet it will show u ur physical ip address which is always 127.0.0.1 so have fun hope people learn from this.
Attachments
Ninja IP Finder with Source.zip
(7.58 KiB) Downloaded 46 times
NinjaCoder
 

Postby DJ__GaNgsTeR » Thu Jan 18, 2007 1:08 pm

hummmmmmm
jus
DJ__GaNgsTeR
 

Get External IP Adress WAN IP

Postby delta-x » Thu Mar 29, 2007 1:55 pm

Public Function GetPublicIP()
Dim sSourceUrl As String
Dim sLocalFile As String
Dim hfile As Long
Dim buff As String
Dim pos1 As Long
Dim pos2 As Long
sSourceUrl = "http://vbnet.mvps.org/resources/tools/getpublicip.shtml"
sLocalFile = "c:\ip.txt"
Call DeleteUrlCacheEntry(sSourceUrl)
If DownloadFile(sSourceUrl, sLocalFile) Then
hfile = FreeFile
Open sLocalFile For Input As #hfile
buff = Input$(LOF(hfile), hfile)
Close #hfile
pos1 = InStr(buff, "var ip =")
If pos1 Then
pos1 = InStr(pos1 + 1, buff, "'", vbTextCompare) + 1
pos2 = InStr(pos1 + 1, buff, "'", vbTextCompare) '- 1
GetPublicIP = Mid$(buff, pos1, pos2 - pos1)
Else
GetPublicIP = "Your Application can't get you wan ip address"
End If
Kill sLocalFile
Else
GetPublicIP = "Your Application can't get you wan ip address"
End If
End Function
We Are The WorlD
User avatar
delta-x
 
Posts: 3
Joined: Mon Oct 16, 2006 3:17 pm

Previous

Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests