CodedK
asked on
External Ip
Hi.
How can i get my external ip ??
(A question asked a million times BUT i only get local ip from other PAQ solutions)
I am behind a router !...
Is there a way to get it except visiting a page and grab the ip string?
I found a promising PAQ here :
https://www.experts-exchange.com/questions/21408046/Network-cards.html
Everything works except "FCurrentIpAddress".
I get a memory read/write error when i try to use it.
Thanks in advance.
How can i get my external ip ??
(A question asked a million times BUT i only get local ip from other PAQ solutions)
I am behind a router !...
Is there a way to get it except visiting a page and grab the ip string?
I found a promising PAQ here :
https://www.experts-exchange.com/questions/21408046/Network-cards.html
Everything works except "FCurrentIpAddress".
I get a memory read/write error when i try to use it.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi calinutz.
Thanks but i have that code ... :/
I allready said : "except visiting a page and grab the ip string"
Chack that link i gave... It can get every other info.
Thanks but i have that code ... :/
I allready said : "except visiting a page and grab the ip string"
Chack that link i gave... It can get every other info.
codedk, there is absolutly no way of getting the real IP address except getting it from an external source (like a website or dedicated server). there are tons of ways to "turn" a LAN ip into an external one, and most of them use software, and not hardware, so there is no standard. the best and easiest way is to use one of the showmyip pages, just as calinutz suggested.
ASKER
:)
Hi ciuly.
Ok, i guess i knew that (or saw that coming) , but one last thing...
Since i've used katka source (link above) to get all the other info (Hardware oriented solution),
can anyone make the FCurrentIpAddress work ? (Just out of curiocity coz every other info worked).
Maybe its my hardware the problem thats why i'm asking.
Hi ciuly.
Ok, i guess i knew that (or saw that coming) , but one last thing...
Since i've used katka source (link above) to get all the other info (Hardware oriented solution),
can anyone make the FCurrentIpAddress work ? (Just out of curiocity coz every other info worked).
Maybe its my hardware the problem thats why i'm asking.
actually, certain routers will let you query them and will tell you your external ip (via telnet etc)
try
telnet (router ip address)
and see if you can find a command to show you the external ip your isp has assigned you.
be careful in there though :-)
some specific ISPs have a webpage also, but you do not want this approach
try
telnet (router ip address)
and see if you can find a command to show you the external ip your isp has assigned you.
be careful in there though :-)
some specific ISPs have a webpage also, but you do not want this approach
GetAdaptersInfo can NOT be used to resolve your external IP address, but there is a way using iphlpapi and the function GetBestRoute.
It basically amounts to starting with the local address and giving it a dest address; something like "www.google.com". This will fill in a block giving you the next forward address. Then its a matter of calling GetBestRoute again until the address is no longer in the private address range of 192.x.x.x / 10.x.x.x. (then you need to add 1 to the final byte of x.x.x.x).
I can provide an example shortly if you would find it helpful
Russell
ASKER
I'd like that Russell.
Thanks :)
Thanks :)
Never mind...
The problem is not that it doesn't work, its just that the routing table information is for the *outbound* direction. The inbound direction (how others see your IP), and the route path that they would use to get to you is not always the same as the outbound path. For your problem, the most reliable (and generic) solution is going to be connecting to one of the numerous 'whats my ip' sites and parsing the IP address out.
Regards,
Russell
ASKER
:) Ok thanks for all the suggestions.
Regards