PDA

Click to See Complete Forum and Search --> : IP Address


Azrael
Aug 31st, 2000, 01:00 PM
I'm currently working on a program to communicate across the internet, but in order to do so, I need to be able to detect my IP address. As I am on a LAN, when I try to do this, it returns my LAN IP, whereas I need to get my internet IP. Is there a way to do this?

Thanks in advance,

Az.

Dim
Aug 31st, 2000, 05:06 PM
Place the winsock control on thr form and a label then add this code.

Label1.Caption = Winsock1.LocalIP


Hope that helps,
D!m

Azrael
Aug 31st, 2000, 05:43 PM
I'm currently using the winsock control to communicate, and unfortunately, when you use the localip property, it returns the IP from the LAN, rather than your internet connection.

Edneeis
Sep 1st, 2000, 02:48 AM
You have to start the winsock control after you are connected to the internet to get the Internet IP I think.
I was trying to get the same info and that was the easiest way I found, definately not the best though.

Azrael
Sep 1st, 2000, 01:56 PM
Unfortunately not, I have started the program many times after connecting to the internet, but with no luck.

Dip
Sep 5th, 2000, 11:49 PM
While searching for the answer to the same problem, I came across a link to the following msn knowledge base page:
http://support.microsoft.com/support/kb/articles/q160/2/15.asp
It has a loop in it to account for multi-homed addresses.

Dip

Azrael
Sep 7th, 2000, 01:52 PM
Thanks, Dip, that code did exactly what I was looking for.