I already detect local IP address of my computer using this code (use sockets):
Function Ip_Local : String;
Var Acces_Sock : TCustomIpClient;
Begin
Acces_Sock := TCustomIpClient.Create(Nil);
Try
Result := Acces_Sock.LocalHostAddr
Finally
Acces_Sock.Free;
End;
End;
What about detecting the internal LAN IP address of the router and, if possible, of any LAN-connected appliance such as a DVR?
For Windows Users: Type CMD in the search box and click Run as Administrator from the menu. Enter the net view command to view devices connected to your network You will then see a list of devices connected to your network in the output.
From the desktop, navigate through; Start > Run> type "cmd.exe". A command prompt window will appear. At the prompt, type "ipconfig /all". All IP information for all network adapters in use by Windows will be displayed.
Using Indy:
function CsiGetRemoteIpAddress(const pHostName: string): string;
begin
TIdStack.IncUsage;
try
Result := GStack.ResolveHost(pHostName);
finally
TIdStack.DecUsage;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With