summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fcl-base/examples/testrnre.pp
blob: 68fd3aad0324d352722426c3c7f2be01959efb47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{$mode objfpc}
{$h+ }

{ Test reverse net resolve }

program testrnre;

uses resolve;

Var
  I : integer;
  S : String;


begin
  If (ParamCount>0) then
    S:=Paramstr(1)
  else
    S:='127.0.0.0';
  With TNetResolver.Create(Nil) do
    try
      If Not AddressLookup(S) then
        Writeln('Lookup failed : ',LastError)
      else
        begin
        Writeln('Name          : ',ResolvedName);
        Writeln('Addres        : ',AddressAsString);
        Writeln('Alias count   : ',AliasCount);
        For I:=0 to AliasCount-1 do
          Writeln('Alias ',i:2,'  : ',Aliases[I]);
        end;
    finally
      Free;
    end;
end.