Using synapse version 40.1 this code snippet fails to receive the string
var
FConn:TTCPBlockSocket
....
if FConn.CanRead(3000) then begin
FileVersion:=FConn.RecvString(12000);
end;
However, if I change the code to:
FileVersion:='';
Start:=GetTickCount64;
while FileVersion='' do begin
if FConn.CanRead(0) then begin
FileVersion:=FConn.RecvString(12000);
end;
if (GetTickCount64 - Start)>1000 then begin
// timeout
break;
end;
end;
if FileVersion <>'' then begin
...
end;
.......
It successfully receives the string
I think in the first verson, FConn.CanRead(3000) will wait for 3000 miliseconds to check if the string arrive, while in the secod version it only wait for 1000 ms to check. My question is why the first version fails even though it waits longer?