This message was edited by Masterijn at 2004-2-24 14:40:56
This message was edited by Masterijn at 2004-2-24 14:40:34
This message was edited by Masterijn at 2004-2-24 14:40:7
: How can i find out the IP of a network computer or the ip of all computers that are in the network?
: 10x
:
:
For a single computer you can use:
uses
WinSock;
function LookupName(const Name: string): TInAddr;
var
HostEnt: PHostEnt;
InAddr: TInAddr;
begin
HostEnt := gethostbyname(PChar(Name));
FillChar(InAddr, SizeOf(InAddr), 0);
if HostEnt <> nil then
begin
with InAddr, HostEnt^ do
begin
S_un_b.s_b1 := Byte(h_addr^[0]);
S_un_b.s_b2 := Byte(h_addr^[1]);
S_un_b.s_b3 := Byte(h_addr^[2]);
S_un_b.s_b4 := Byte(h_addr^[3]);
end;
end;
Result := InAddr;
end;