Paul,
thank you for your continuous support.
This is a draft. I hope this will give you a correct view:
procedure TTransfer.TriggerAvail(CP: TObject; Count: Word);
var
I: Integer;
C: Char;
begin
if count > 0 then
begin
for I := 1 to Count do
begin
inc(MessIncr);
ReceiveBuf[MessIncr] := TApdWinsockPort(CP).GetChar;
If MessIncr = Awaited then
Allprocessed := true;
end;
end;
end;
procedure MySendData(Address: Longint);
begin
for I := 1 to 3 do
begin
NewTimerSecs(et,2);
TimeOut := false;
Allprocessed := false;
MessIncr := 0;
SendCommand(Address);
Repeat
Application.processmessages;
if TimerExpired(et) then
TimeOut := true;
until AllProcessed or TimeOut;
if Allprocessed then break;
end;
if Not timeOut then ProcessData(ReceiveBuf);
end;
>> FCom.Putblock()
>> repeat
>> application.processmessages;
>> until Allreceived or timeout;
>>
>> What can I do then, to get it work correctly?
>
> Since you have application.processmessages in your loop, the loop
> itself should not be the problem.
>
> Is this loop in an AsyncPro event handler or in a routine that is
> called from an AsyncPro event handler? The fact that the output is
> delayed by two seconds seems to indicate something like that might be
> the issue.