TAstaServerSocket.OnCodedStream


 

Applies to
TAstaServerSocket

 

Declaration
property OnCodedStream : TAstaServerStreamEvent;

 

Description
The OnCodedStream event is similar to the
OnCodedMessage event, the MsgID allows you to create your own protocol codes and then take custom action corresponding to that code. The OnCodedStream event handler is for handling streams and blobs. See the SendCodedStream method.

 

The following code takes a stream from the server, and as dictated by the user-defined 850 protocol code, it displays the stream in a memo field, then writes it to a file.

 

procedure TForm1.AstaServerSocket1CodedStream(Sender: TObject;
  ClientSocket: TCustomWinSocket; MsgID: Integer; MS: TMemoryStream);

begin

  case MsgID of

    850: begin

           mServerMemo.Lines.Clear;

           mServerMemo.Lines.LoadFromStream(MS);

           mServerMemo.Lines.SaveToFile('ServerFile.txt');

         end;

  end;

end;

 

 



ASTA Overview TAstaServerSocket.OnCodedParamList TAstaServerSocket.OnCompress