Ok hab es gelöst, hab ein extra Thread zum lesen genommen...
DA meine Lösung:
Delphi-Quellcode:
Unit cTReadThread;
Interface
Uses IdTCPClient, Classes;
Type
TOnReadEvent =
Procedure ( TheTIdTCPClient: TIdTCPClient; AString:
String )
Of Object;
TReadThread =
Class( TThread )
Private
{ Private-Deklarationen }
Protected
{ Protected-Deklarationen }
FOnRead: TOnReadEvent;
MyTIdTCPclient: TIdTCPClient;
Public
{ Public-Deklarationen }
Published
{ Published-Deklarationen }
Constructor Create( CreateSuspendend: Boolean; TheTIdTCPClient: TIdTCPClient );
Property OnRead: TOnReadEvent
read FOnRead
write FOnRead;
Procedure Execute;
Override;
End;
Implementation
Constructor TReadThread.Create( CreateSuspendend: Boolean; TheTIdTCPClient: TIdTCPClient );
Begin
Inherited Create( CreateSuspendend );
MyTIdTCPclient := TheTIdTCPClient;
End;
Procedure TReadThread.Execute;
Begin
While Not Terminated
Do Begin
If Assigned( FOnRead )
Then FOnRead(MyTIdTCPclient, MyTIdTCPclient.CurrentReadBuffer );
//If Assigned( FOnRead ) Then FOnRead(MyTIdTCPclient, MyTIdTCPclient.ReadLn );
End;
End;
end.
Bye