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?
Using Indy:
function CsiGetRemoteIpAddress(const pHostName: string): string;
begin
TIdStack.IncUsage;
try
Result := GStack.ResolveHost(pHostName);
finally
TIdStack.DecUsage;
end;
end;
精彩评论