Hello Dod, > MySocket:=TWSocketServer.Create(nil); > MySocket.OnClientCreate:=MyOnClientCreate; > MySocket.OnClientConnect:=MyOnClientConnect; > MySocket.OnDataAvailable:=MyOnDataAvailable;
Ok what you do wrong is followin: MySocket is a server. A server never receives data, so assigning to his OnDataAvailable is no use. The reason wy it is listed in the properties is because TWSocketServer is derrived from TWSocket. > Doing this will not make MyOnDataAvailable work unless I also put it > on the MyOnClientConnect; It will never work, no matter where you create it. What should work is if the Client is created then you have to assign MyOnDataAvailable to the client socket, not to the server socket, wich you probably does because you say it works. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Wednesday, February 15, 2006, 16:03, Dod wrote: > Hello Francois, > Yes, I mistaken : > MySocket:=TWSocketServer.Create(nil); > MySocket.OnClientCreate:=MyOnClientCreate; > MySocket.OnClientConnect:=MyOnClientConnect; > MySocket.OnDataAvailable:=MyOnDataAvailable; > Doing this will not make MyOnDataAvailable work unless I also put it > on the MyOnClientConnect; >>> I saw in online ICS help that OnClientConnect was place to assign FP>> This event is for TWSocketServer which instanciate a new FP>> TWSocket for each client connection. Don't FP>> confuse TWSocketServer own events and TWSocket created instances events. FP>> -- FP>> [EMAIL PROTECTED] FP>> http://www.overbyte.be FP>> ----- Original Message ----- FP>> From: "Dod" <[EMAIL PROTECTED]> FP>> To: "ICS support mailing" <twsocket@elists.org> FP>> Sent: Wednesday, February 15, 2006 2:51 PM FP>> Subject: Re: [twsocket] Properties and event declarations >>> Hello Francois, >>> >>> For one of the question you answered : each .Connect you must >>> re-assign IP+Port+Proto properties. >>> >>> For other question I try to re-explain better. If do do this : >>> >>> MySocket:=TWSocket.Create(nil); >>> MySocket.OnClientConnect:=MyOnClientConnect; >>> MySocket.OnClientDataAvailable:=MyOnClientDataAvailable; >>> >>> Then it seems the OndataAvailable will never trigger. >>> >>> But if I put MySocket.OnClientDataAvailable:=MyOnClientDataAvailable >>> inside the MyOnClientConnect, then it will work correctly. >>> >>> Question : is it normal that if I assign the event after .Create, it >>> will not be automatically assigned to new incoming client ? >>> >>> I saw in online ICS help that OnClientConnect was place to assign >>> event handlers (which one ? I suppose it is all OnClientXXX). I do it >>> but I was wondering which other properties or events must be always >>> re-assigned manually at new outgoing or incoming connection either in >>> OnCreate or OnConnect. >>> >>> Hope I am more understandable. >>> >>> I have no special problem with it (but I had some when I started to >>> use ICS some years ago), but it is for my ICS FAQ. >>> >>> Regards. >>> >>> >>> FP> Sorry but I don't understand the question ! >>> FP> Here is an answer (if it answer one of your questions): >>> FP> You must re-assign Addr, Port and Protocol after the socket has been >>> closed. >>> FP> -- >>> FP> [EMAIL PROTECTED] >>> FP> http://www.overbyte.be >>> >>> >>> FP> ----- Original Message ----- >>> FP> From: "Dod" <[EMAIL PROTECTED]> >>> FP> To: "ICS support mailing" <twsocket@elists.org> >>> FP> Sent: Wednesday, February 15, 2006 12:08 PM >>> FP> Subject: [twsocket] Properties and event declarations >>> >>> >>> >> Hello, >>> >> >>> >> Is there a list of which properties and events are not "inherited" >>> >> from the ones set after .Create and which ones must be re-set again >>> >> after a socket close (for socket.connect I think it is just ip+port as >>> >> they are the only ones raising an error but I am not about other >>> >> properties). >>> >> >>> >> ICS help file tell a bit about it for OnClientCreate that is a good >>> >> place for doing a ThreadDettach/Attach and OnClientConnect that is a >>> >> place to declare events (but which ones ?). >>> >> >>> >> For example if you do a >>> >> TWSocket.OnDataAvailable:=MyOnDataAvailable after the >>> >> TWSocket.Create, then no OnDataAvailable event will trigger and you must >>> >> set it in the OnClientConnect. >>> >> >>> >> Other example, when a socket is closed and you want to re-connect to a >>> >> server you must re-set IP and port before, whenever you already set >>> >> them after TWSocket.Create (but in that case it this is not real >>> >> problem as an error is Raised telling you about missing IP or Port >>> >> properties so you can't do declaration at wrong place). >>> >> >>> >> I use to declare many properties/events twice, one after .Create and >>> >> other OnClientConnect but if a list describe which/where I am >>> >> interested reading it. >>> >> >>> >> Regards. >>> >> >>> >> -- >>> >> 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 >>> >>> -- >>> 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 -- 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