It is always advised to perform all the sending / receiving tasks in OnExecute
event handler of TIdTCPServer
, but I do not understand following:
How to wait for a specific sequence on input and at the same time send some data to the same client? I need not a command-response sequence, but I need to:
- send live data constantly
- while receiving edited data back
- and receiving commands and provide responses for them.
For example, if we are waiting for CR-LF:
procedure TSocketServer._serverExecute(AContext: TIdContext);
var
msg: string;
begin
msg := AContext.Connection.IOHandler.ReadLn();
//Here we are only if CRLF was detected.
//How to send while we are waiting?
_log(msg);
end;