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 "22.214.171.124".
However, the program wont connect. On further search for my IP,
WhatismyIP.com states that mY actual IP is "126.96.36.199".
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.