Runtime created TClientSocket OnError event not firing.

Hello all,

I have created a form with an attached thread, containing a dynamically created TClientSocket. The nescessary code I used is as follows:

Code in the calling Form:

procedure TClientForm.FormCreate(Sender: TObject);
Client := TClientThread.Create(Handle);
Client.ConnectPort := 5000;
Client.ConnectIP := '';

Code in the Thread itself:

procedure TClientThread.Execute;
if NOT Terminated then begin
        ClientSocket := TClientSocket.Create(nil);
        ClientSocket.Address := ConnectIP;
        ClientSocket.Port := ConnectPort;
        ClientSocket.ClientType := ctBlocking;
        ClientSocket.Name := 'ClientSocket';
        ClientSocket.OnError := ClientSocketError;
        ClientSocket.Socket.OnErrorEvent := ClientSocketError;
//I saw this line above in some example but it isn't any better
        ClientSocket.OnConnect := ClientSocketConnect;
        ClientSocket.OnDisconnect := ClientSocketDisconnect;
        ClientForm.Memo1.Lines.Add('Client created');
while not terminated do begin
        ClientForm.Memo1.Lines.Add('Client is running');

All seems to work fine. The Connect and Disconnect events are fired correctly but the OnError event doesn't fire OR the procedure attached to the event doesn't work.

Am i missing a point here or is this just a weird error.
Note: when I copy-paste the code into a Design Time created TClientSocket the onError event DOES fire and the error-message IS suppressed due to the "ErrorCode :=0" line.

Any help on this matter would be great!

remove the .nospam to mail me directly.