TRPCBroker Example

The following example demonstrates how a TRPCBroker component can be used to connect to the server, execute various remote procedures, return the results and finally disconnect from the server. This example assumes that a TRPCBroker component already exists on the form:

procedure TForm1.Button1Click(Sender: TObject);
begin
  try
    RPCBRoker1.Connected := True;                          {connect to the server}
    RPCBroker1.RemoteProcedure := 'SOME APPLICATION RPC';  {assign RPC name}
    RPCBroker1.Call;                                       {make the call}
    ListBox1.Items := RPCBroker1.Results;                  {display results}
    RPCBroker1.Connected := False;                         {disconnect from the server}
  except
    {put error handling code here}
  end;
end;