TAstaClientSocket.SendCodedParamList


 

Applies to
TAstaClientSocket

 

Declaration
procedure SendCodedParamList(MsgId: Integer; Params:TAstaParamList);

 

Description
The SendCodedParamList method is one of the more powerful methods in ASTA. It allows you to send mixed data types easily. For a fuller discussion see
ASTA Messaging.

 

The following example is taken from the CodedParams Tutorial. It 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.

 

procedure TForm1.SendFileClick(Sender: TObject);

var

  Params: TAstaParamList;

begin

  if not OpenDialog1.Execute then Exit;

  Memo1.Lines.LoadFromFile(OpenDialog1.FileName);

  Params := TAstaParamList.Create;

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

  Params.FastAdd(Now);

  Params.FastAdd(Memo1.Text);

  AstaClientSocket1.SendCodedParamList(15, Params);

  Params.Free;

end;

 

 

The next bit of code shows how an AstaParamList can be created and packed with any kind of data including binary data. It uses an AstaParamList call "FastAdd" that adds an AstaParam, gives it a generic name, and sets the data type according to the type of data fed to it.

 

FastAdd('MyString');

FastAdd(45);

 

This is equivalent to saying:

Params.Add;

Params[0].AsString := 'My String';

Params.Add;

Params[1].AsInteger := 45;

 

 



ASTA Overview TAstaClientSocket.SendCodedMessage TAstaClientSocket.WaitingForServer