How to use Delphi to get my Actual IP instead of Local IP?
Posted on 2005-04-18
i'm writing a simple client/server application which can transfer text, using Clientsocket and serversocket. I need to know my IP address before the program could connect, thats where the problem comes. Below is the code to get my LocalIP:
Function GetLocalIP: string;
P : PHostEnt;
S : array [0..128] of char;
The code detect my IP as "188.8.131.52".
However, the program wont connect. On further search for my IP,
WhatismyIP.com states that mY actual IP is "184.108.40.206".
There are tips on how to connect to WhatismyIP.com and get my actual IP using Tbrowser components. But i dont wish to connect to websites.
Anyone knows how to code in Delphi to get my actual IP? it should be a function, and by just clicking on a button, the actual IP will be shown.