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: 1991
Discussions: 200,919, Posts: 2,379,073, Members: 246,287
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,382
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 online now   Reply With Quote
Old November 25th, 2003, 04:23 PM     #4 (permalink)
Member
 
Join Date: Oct 2003
Posts: 263
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,382
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 online now   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,382
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 online now   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? (2850)
Obama the Muslim (13)
Why is Khalid Sheikh Mohammed even .. (9)
Is the PSU I received dead? (10)
windows vista security holes (8)
Foreign voltage (10)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (9)
Print spooler problem (12)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
windows vista security holes (8)
monitor will not turn on at all, (1)
Print spooler problem (12)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (33)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
Modern Warfare 2: Who Bought It? (61)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
HIS HD5770 graphic card question (15)
Best file format to play on Windows H.. (0)
PSP Go bought in Japan (0)
Asus P4G8X Mobo (3)
Need hard disk drivers (4)
windows 7 internet problem (4)


All times are GMT -4. The time now is 08:12 PM.
TechIMO Copyright 2009 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