So, ich habs nochmal überarbeitet, so scheint das jetzt zu funktionieren:
Delphi-Quellcode:
procedure TClientReader.Execute;
var
LReadString : AnsiString;
LBuf : TIdBytes;
i : Integer;
begin
while not Terminated
do
begin
sleep(10);
try
if Assigned(FClient)
and Assigned(FClient.IOHandler)
and FClient.Connected
then
begin
with FClient.IOHandler
do
try
CheckForDataOnSource(10);
if not InputBufferIsEmpty
then
begin
LBuf:=nil;
InputBuffer.ExtractToBytes(LBuf);
with TStringList.Create
do
try
Text:= BytesToString(LBuf);
while Count > 0
do
begin
LReadString:=Strings[0];
Delete(0);
if(Length(Trim(LReadString))>0)
then
begin
if Assigned(FClient.ReaderEvent)
then
begin
FClient.ReaderEvent(LReadString);
end;
end;
end;
finally
Free;
end;
end;
except
on e : EIdClosedSocket
do SNLogger.Log('
TClientReader.Execute:EIdClosedSocket:'+e.ClassType.ClassName+'
:'+e.
message);
on e : EIdReadTimeout
do SNLogger.Log('
TClientReader.Execute:EIdReadTimeout:'+e.ClassType.ClassName+'
:'+e.
message);
on e : EIdException
do SNLogger.Log('
TClientReader.Execute:EIdException:'+e.ClassType.ClassName+'
:'+e.
message);
on e :
exception do SNLogger.Log('
TClientReader.Execute:Exception:'+e.ClassType.ClassName+'
:'+e.
message);
end;
end;
except
on e :
exception do
begin
SNLogger.Log('
TClientReader.Execute:'+e.ClassType.ClassName+'
:'+e.
Message);
exit;
end;
end;
end;
end;
Mal einen Tag am Stück laufen lassen und schaun obs morgen immernoch läuft.
Danke plusplus unt Assertor