When i send a message from TCPClient
to a TCPServer
it will be handled using OnExecute
event in the server . Now i want to handle the rece
Add a TTimer
.
Set its Interval
to 1
.
Write in OnTimer
Event:
procedure TForm1.Timer1Timer(Sender: TObject);
var
s: string;
begin
if not IdTCPClient1.Connected then Exit;
if IdTCPClient1.IOHandler.InputBufferIsEmpty then Exit;
s := IdTCPClient1.IOHandler.InputBufferAsString;
Memo1.Lines.Add('Received: ' + s);
end;
Don't set Timer.Interval
something else 1
.
Because, the received data deletes after some milliseconds.