TAstaClientSocket.SendGetCodedParamList


 

Applies to
TAstaClientSocket

 

Declaration
function SendGetCodedParamList(MsgId: Integer; Params:TAstaParamList) :TAstaParamList;

 

Description
The SendGetCodedParamList method is one of the more powerful methods in ASTA. It allows you to send mixed data types easily. SendGetCodedParamList will wait for the server to receive and send a reply and a
TAstaParamList will be returned which you are responsible for destroying. SendGetCodedParamList is a blocking call. If you want to use asyncronous messaging the use SendCodedParamList. See ASTA Messaging for a fuller discussion on messaging options.

 

The following example shows how to open a text file and send the file name, file size, the file itself and the current date and time to the server which then displays it in the ASTA server request memo that normally shows incoming SQL requests and returns back a ParamList. On the server the OnCodedParamList event must be coded.On the server the OnCodedParamList event must be coded by

 

1. using any incoming params.
2. clearing the params.
3. filling the params with what you want to be returned to the client.
4. you need not send it back as it will be transported by ASTA in a thread.

 

 

procedure TForm1.SendFileClick(Sender: TObject);

var

  Params, RetParams: TAstaParamList;

begin

  if not OpenDialog1.Execute then Exit;

  Memo1.Lines.LoadFromFile(OpenDialog1.FileName);

  Params := TastaParamList.Create;

  try

    Params.FastAdd(OpenDialog1.FileName + ' File Size of ' +
      IntToStr(Length(Memo1.Text)));

    Params.FastAdd(Now);

    Params.FastAdd(Memo1.Text);

    RetParams := AstaClientSocket1.SendCodedParamList(15, Params);

  finally

    RetParams.Free;

    Params.Free;

  end;

end;

 

 



ASTA Overview TAstaClientSocket.SendCodedStream TAstaClientSocket.SendProviderTransactions