hello, i have defined a small class for ClientClass to use with TWSocketServer wich have an event that it should call, but i remarked that when the server try to call TriggerClientCreate(Client); in the TriggerSessionAvailable method, it calls my event .. here is the class : unit Test; interface uses Classes, WSocketS; type TMyEvent = procedure (Sender: TObject; const AnObject: TObject) of object; TWSockClient = class(TWSocketClient) protected FMyEvent: TMyEvent; procedure DataReceived(Sender: TObject; ErrCode: Word); published constructor Create(AOwner: TComponent); override; property MyEvent: TMyEvent read FMyEvent write FMyEvent; end; implementation constructor TWSockClient.Create(AOwner: TComponent); begin inherited Create(AOwner); OnDataAvailable := DataReceived; end; procedure TWSockClient.DataReceived(Sender: TObject; ErrCode: Word); begin //Some job to do Text; if Assigned(FMyEvent) then FMyEvent(Sender, nil); end; end.
and here is a small test procedure TFrmTest.Test(Sender: TObject; const Obj: TObject); begin ShowMessage('ok'); end; procedure TFrmTest.ServClientConnect(Sender: TObject; Client: TWSocketClient; Error: Word); begin TWSockClient(Sender).MyEvent := Test; end; just implement this in a form and try to connect the first time to the server, everything will be done correctly, but in the next connection, the server will call Test when he calls TriggerClientCreate any idea please, if you need me to prepare all the units in an example, just told me. --------------------------------- Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez le ici ! -- 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