home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Can VB retrieve my dynamic IP from my Linksys router?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1860
Discussions: 200,511, Posts: 2,374,418, Members: 245,834
Old November 14th, 2003, 05:21 PM   Digg it!   #1 (permalink)
Member
 
DrDave1958's Avatar
 
Join Date: Oct 2003
Location: In the middle....
Posts: 161
Can VB retrieve my dynamic IP from my Linksys router?

I have a DSL modem > Linksys router > PC. What I think I want to do (feel free to suggest alternatives) is write a VB program to retrieve my dynamic IP address (WAN), (which my ISP feels the need to change every couple of days), then email it in a text file or something equivalent. I have (some) experience writing VB code, but I'm not advanced by any means.

Maybe there's some software available to grab the IP?

I remote in to my home PC from work occaisionally and of course I can't when the IP has changed without trying 255 different IP addresses (The first three sets are always the same, e.g. xxx.xxx.xxx.1-255).

Thanks for any ideas,
-Dave-
DrDave1958 is offline   Reply With Quote
Old November 14th, 2003, 05:30 PM     #2 (permalink)
Ultimate Member
 
AzKidd69's Avatar
 
Join Date: Oct 2001
Location: Queen Creek, AZ
Posts: 1,480
Send a message via MSN to AzKidd69 Send a message via Yahoo to AzKidd69
why not try a dynamic dns provider such as no-ip.com or dynip.com

here's a bunch more to look @ http://www.google.com/search?sourcei...8&q=dynamic+ip

you are trying to do exactly what they are used for....
__________________
Never argue with a computer, without a hammer.
Never program and drink beer at the same time.
Never trust a programmer who carries a screwdriver.
AzKidd69 is offline   Reply With Quote
Old November 14th, 2003, 05:49 PM     #3 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,215
If you want to do it just as a project to give it a shot...
what you could do is maybe make a HTTP request to www.whatismyip.com and parse through the response for your IP.

Az's response is by far the easiest and most common method
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is offline   Reply With Quote
Old November 25th, 2003, 04:23 PM     #4 (permalink)
Member
 
Join Date: Oct 2003
Posts: 264
very easy to do

I dont know how well you know vb but here goes...

Open or start a new project

->Project
-->Components

->go down to Microsoft Winsock ver. bla bla (check that off and hit ok)

->Put the tool from the tool menu on the form.

The code on the form is as follows:


Private Sub Form_Load()
Dim strIP As String

strIP = Winsock1.LocalIP

End Sub


Basically all you are doing is throwing your ip address into a variable called strIP...if you have any questions post back or e-mail me
amtrac24 is offline   Reply With Quote
Old December 2nd, 2003, 08:04 PM     #5 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,215
amtrac, you forgot he needs to get his routable IP.. not the local IP
His local machine will have a 192.168.1.x IP which is useless out on the internet. He needs to know the IP his ISP gives him.
vass0922 is offline   Reply With Quote
Old December 2nd, 2003, 10:10 PM     #6 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
I tried it. It doesn't return my IP for my LAN. I got a 169.xxx.xxx.xxx so I assume its my routers IP or something.
Creosote is offline   Reply With Quote
Old December 2nd, 2003, 11:17 PM     #7 (permalink)
Member
 
DrDave1958's Avatar
 
Join Date: Oct 2003
Location: In the middle....
Posts: 161
I'm not sure what you're actually after Creosote but here's the solution I ended up with which retrieves my WAN IP and then emails it to my Hotmail account thru Oulook Express. I then run it everyday in scheduled task.


----------------------------------------------------
Public My_IP As String
Public MY_date As Date

Private Sub Send_My_IP()
Dim b1 As Boolean
Call MessageCall
b1 = False
MAPISession1.SignOn
MAPISession1.DownLoadMail = False
With MAPIMessages1
.SessionID = MAPISession1.SessionID
.Compose
.RecipAddress = "Smee@hotmail.com"
.AddressResolveUI = True
.ResolveName
.MsgSubject = "Home IP at " & Time & " on " & Date
.MsgNoteText = "My home IP is " & My_IP & " on " & Date
.Send False
End With
MAPISession1.SignOff
End Sub

Private Sub Form_Load()
Call Send_My_IP
End
End Sub

Sub MessageCall()
MY_date = Date + Time
My_IP = MessageLoad("www.showmyip.com/simple/")
End Sub

Function MessageLoad(URL As String) As String
Dim IEApp As Object
Dim IEDocument As Object
Dim i As Long
Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Visible = False
IEApp.Navigate URL
Do: Loop Until IEApp.Busy = False
Set IEDocument = IEApp.Document
MessageLoad = IEDocument.Body.innerText
IEApp.Quit
Set IEDocument = Nothing
Set IEApp = Nothing
End Function
--------------------------------------------------------

Outlook Express has to be setup to not prompt you for sending mail.

-Dave-
DrDave1958 is offline   Reply With Quote
Old December 3rd, 2003, 12:20 AM     #8 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
I was saying I tried amtrac24's solution and it's not giving me my local LAN address.

Your solution looks cool. Here is another solution to send the email with CDO if you want to try that too.

http://support.microsoft.com/?id=286431
Creosote is offline   Reply With Quote
Old December 3rd, 2003, 07:29 PM     #9 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,215
169.254.x.x is a BS IP MS gives to a network card that is set to DHCP but can't reach a DHCP server.
Chances are you got the IP of a network interface with no IP.
(there's about 10 on any given win2k/XP machine stupid WAN interfaces that it hides from the user)
vass0922 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (1636)
FT HOOD attack: 7 killed 12 injured (67)
Review My Build (6)
HELP!!! What do you think of this s.. (16)
Looking for a graphic card that wil.. (30)
Assosiations (21498)
My 1st pc build (40)
PC Modern Warfare 2: it's much wors.. (12)
Aero in Vista (7)
core i7 extreme 975, nvidia 9400gt (9)
How to Ship a PC (16)
Building my first computer (13)
[F@H SPAM 11/1/09]New month . . . n.. (33)
slaving laptop drive (7)
Recent Discussions
New processor technical problem (0)
windows 7 retail and rtm (4)
boot from CD-ROM in chipset via P4M80.. (2)
Powe Director v8 (0)
Windows Experience Index is screwed u.. (3)
Review My Build (6)
FAT32 to NTFS file system in Win2kpro (4)
Internet very slow since updating AVG.. (8)
Motherboards and my curse... (25)
HELP!!! What do you think of this sys.. (16)
New Processor, Monitor will not turn .. (2)
2009 Build (4)
My 1st pc build (40)
Freezing During Music/Movies (1)
ext. sound card laptop to stereo syst.. (2)
Remote Desktop via SSH and error mess.. (2)
Help and Support disappeared from my .. (0)
[F@H SPAM 11/1/09]New month . . . new.. (33)
Basic applications needed for "r.. (1)
core i7 extreme 975, nvidia 9400gt (9)
hard drive problem (2)
Win7 TrustedInstaller Permissions (2)
Speed up Win 7 boot time a bit (1)
Hard Drive test program (2)
wireless westell versalink model 327w (1)


All times are GMT -4. The time now is 09:13 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28