usesScktComp;procedure TMyClientThread.Execute;varpStream: TWinSocketStream;buffer: string;begin{ create a TWinSocketStream for reading and writing }pStream := TWinSocketStream.Create(ClientSocket1.Socket, 60000);try { fetch and process commands until the connection or thread is terminated } while (not Terminated) and (ClientSocket1.Active) do begintryGetNextRequest(buffer); { GetNextRequest must be a thread-safe method }{ write the request to the server }pStream.Write(buffer, Length(buffer) + 1);{ continue the communication (e.g. read a response from the server) }...exceptif not(ExceptObject is EAbort) then Synchronize(HandleThreadException); { you must write HandleThreadException }end; end;finallypStream.free;end;end;