TAstaServerSocket.ThreadedUtilityEvent
Applies to
TAstaServerSocket
Declaration
procedure ThreadedUtilityEvent(ServerSocket: TAstaServerSocket;
ClientSocket: TCustomWinSocket; CustomEvent: TAstaUtilityEvent;
P: TAstaParamList);
Description
Asta servers are non-blocking and event driven so normal messaging
calls are not threaded. You can have ASTA launch a thread in response to a message from any ASTA client.
If you want to use some database calls in this event use the ThreadedDBUtilityEvent.
See the AstaBDEServer for an example of how to use this method.
The ServerSocket is passed in so that you do not have to access the ServerSocket directly across Thread boundries. The ClientSocket is the actual Socket that is available to each client connected to the server. The CustomEvent your own custom procedure submitted for
threading. It must be a threaded procedure and should take the following format of its declaration which is declared as TAstaUtilityEvent.
procedure NameOfThreadedProcedure(Sender: TObject;ServerSocket:TAstaServerSocket;ClientSocket: TCustomWinSocket;
Params:TAstaParamList);
And in the implementation, a sample would be
procedure TForm1.NameOfThreadedProcedure(Sender: TObject;
ServerSocket:TAstaServerSocket;ClientSocket: TCustomWinSocket; Params:
TAstaParamList);
// var yourvariables here;
begin
// your thread-safe codes here
end;