TMyThread = Class(TThread)
   privat
          clientSocket:TClientSocket;
   public
          constructor create(creatsuspended:Boolean);overload;
          function initClientSocket:boolean;
   protected
          procedure   execute();
end;
 
        constructor TMyThread.create(createsuspended);
        begin
         ...
        end;
        function  TMYThread.initClientSocket:boolean;
        begin
             ClientSocket:=TClientSocket.create(ClientSocket);
             ClientSocket.address:='127.0.0.1';
             ClientSocket.prot:=1514;
             ClientSocket.clientType:=ctNonBlocking;
             ClientSocket.active:=true;
        end; 
        procedure TMyThread.execute;
        begin
             initClientSocket;
             while not terminated and CleintSocket.active do
             begin        // why clientsocket.active is false;
                .......
             end; 
        end;