mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-27 19:33:43 +02:00

* move netdb unit and examples to fcl-net * removed netdb package git-svn-id: trunk@9909 -
52 lines
1017 B
ObjectPascal
52 lines
1017 B
ObjectPascal
program RPCCli;
|
|
|
|
uses SysUtils, Classes, fpAsync, xmlrpc;
|
|
|
|
type
|
|
|
|
TClientApplication = class
|
|
procedure WriteStringCompleted(AParser: TXMLRPCParser);
|
|
procedure AddCompleted(AParser: TXMLRPCParser);
|
|
public
|
|
procedure Run;
|
|
end;
|
|
|
|
procedure TClientApplication.Run;
|
|
var
|
|
Client: TXMLRPCClient;
|
|
begin
|
|
Client := TXMLRPCClient.Create(nil);
|
|
try
|
|
Client.Call(@WriteStringCompleted, 'WriteString', ['A test string']);
|
|
Client.Call(@AddCompleted, 'Add', [123, 456]);
|
|
finally
|
|
Client.Free;
|
|
end;
|
|
end;
|
|
|
|
procedure TClientApplication.WriteStringCompleted(AParser: TXMLRPCParser);
|
|
begin
|
|
WriteLn('"WriteString" call completed');
|
|
end;
|
|
|
|
procedure TClientApplication.AddCompleted(AParser: TXMLRPCParser);
|
|
begin
|
|
WriteLn('"Add" call completed. Result: ', AParser.GetNextInt);
|
|
end;
|
|
|
|
var
|
|
App: TClientApplication;
|
|
begin
|
|
App := TClientApplication.Create;
|
|
try
|
|
try
|
|
App.Run;
|
|
except
|
|
on e: Exception do
|
|
WriteLn('Error: ', e.Message);
|
|
end;
|
|
finally
|
|
App.Free;
|
|
end;
|
|
end.
|