Indy TCP - Lê dados em um loop
Um servidor TCP está enviando quadros de dados continuamente a cada 8ms. Eu quero programar um cliente capaz de receber esses quadros de dados. Existe algum procedimento na Indy 9 para saber se há dados disponíveis no buffer?
Meus programas atuais são os seguintes (estou usando um Thread):
procedure TThreadRead.Execute;
var
buffer: array [0..755] of byte;
//s1: string;
//i: integer;
begin
IdTCPClient1.RecvBufferSize:= 756;
IdTCPClient1.Connect;
while Terminated = false do
begin
if IdTCPClient1.InputBuffer.Size = 0 then
IdTCPClient1.ReadFromStack(True,0,False);
while IdTCPClient1.InputBuffer.Size > 0 do
begin
ReadBuffer(buffer, FClient.InputBuffer.Size);
//s1:= '';
//For i:=0 To Length(buffer)-1 Do
// s1:=s1+IntToHex(Ord(buffer[i]),2); //Read values-->global var
//Form1.Memo1.Text:=s1;
end;
end;
end;
Existe alguma solução mais eficiente para ler dados TCP continuamente (como o evento onread no UDP)?
Desde já, obrigado.