0
Good morning,
I am using the method below to return the IP of the computer, but if I have an active VPN on the computer, it is first getting the IP of the VPN and not the machine. I wonder if it would be possible to control which IP it returns me or another way for me to get the real IP of the computer (from a network card) and not from the VPN and also if it would be possible to get only IPV4 and not IPV6.
Thank you and wait.
Follows code:
function GetLocalIP: String;
var
ipwsa:TWSAData;
p:PHostEnt;
s:array[0..128] of char;
c : PAnsiChar;
begin
c := '';
try
wsastartup(257,ipwsa);
GetHostName(@s, 128);
p := GetHostByName(@s);
c := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
except
on E: Exception do
begin
TVSMLogUtils.GetInstance.LogE(E.Message);
end;
end;
Result := String(c);
end;
Thanks worked out.
– Coradi