Correct way to read records in Indy 10 with TIdTCPClient

Giganews Newsgroups
Subject: Correct way to read records in Indy 10 with TIdTCPClient
Posted by:  Grant Brown (gra…@sitedoc.com.au)
Date: Mon, 21 Aug 2006

Hi,

Is the following the correct manner in which to read records using the
TIdTCPClient component in Indy 10.

If not could someone show me how to do this.

Also how would I gard against a lost connection during the repeat loop

with IdTCPClient do
begin

repeat
  SendCmd(CmdStr_NewLic);
  sleep(50);
  if LastCmdResult.NumericCode in [203,204] then
    begin
      Connection.IOHandler.ReadBytes(ByteBuf, SizeOf(ByteBuf));
      BytesToRaw(ByteBuf, NewLicRec, SizeOf(NewLicRec));
    end;
until LastCmdResult.NumericCode = 204;

end;

TIA

Kind Regards
Grant Brown

--

Replies