Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 9825acea20b8c1730a908ceb6b6baa6d > files > 59

fpc-doc-3.0.4-6.mga7.armv7hl.rpm

{$mode objfpc}
{$h+ }

{ test reverse service resolve }

program testrsre;

uses sysutils,resolve;

Var
  I : integer;
  S : longint;
  P : String;


begin
  If (ParamCount>0) then
    S:=StrToIntDef(Paramstr(1),0)
  else
    S:=23;
  If (ParamCount>1) then
    P:=Paramstr(2)
  else
    P:='';
  With TServiceResolver.Create(Nil) do
    try
      If Not PortLookup(S,P) then
        Writeln('Lookup failed : ',LastError)
      else
        begin
        Writeln('Name          : ',ResolvedName);
        Writeln('Protocol      : ',Protocol);
        Writeln('Port          : ',port);
        Writeln('Aliases       : ',AliasCount);
        For I:=0 to AliasCount-1 do
          Writeln('Alias ',i:2,'  : ',Aliases[I]);
        end;
    finally
      Free;
    end;
end.