Or better try something like this (not tested) procedure TMyThread.Execute; begin prepare the data to be sent Wsocket := TWsocket.Create(nil); try Assign all properties and events .. Wsocket.Send(something); Wsocket.MessageLoop; finally WSocket.Free; WSocket := nil; clean up, thread result etc. if necessary end; end;
procedure TMyThread.WSocketDataSent(Sender: TObject; ErrCode: Word); begin WSocket.CloseDelayed; end; procedure TMyThread.WSocketSessionClosed(Sender: TObject; ErrCode: Word); begin PostMessage(WSocket.Handle, WM_QUIT, 0, 0); end; > >> It's execute method does just check wheter there is something to send >> and if >> yes, it will build a correct data packet and send it. Then it will be >> idle until the next >> send request comes in. >> >> Greetings >> >> Markus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be