procedure TForm1.Timer1Timer(Sender: TObject);
var
Buf: TIdBytes=nil;
n: Integer;
S: String;
begin
if IdTCPClient1.IOHandler.InputBufferIsEmpty then begin
if not IdTCPClient1.IOHandler.CheckForDataOnSource(0) then begin
IdTCPClient1.IOHandler.CheckForDisconnect;
Exit;
end;
end;
Timer1.Enabled := false;
IdTCPClient1.IOHandler.ReadBytes(Buf, 5, False);
S := 'HEX: ';
for n := 0 to Length(Buf)-1 do
S := S + IntToHex(Buf[n], 2) + ' ';
Timer1.Enabled := true;
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.039127111434937 seconds