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;

TWSocketServer itself has a listening TWSocket, when a connection
comes in it creates a new client object derived from TWSocket as well.
So probably you mix something up in your code, take a closer look at
the various demos.

Choose more meaningfull names!!

For instance:

SocketSrv := TWSocketServer.Create(nil);
SocketSrv.OnClientCreate := SocketSrvClientCreate

In SocketSrvClientCreate you assign OnDataAvailable to client 
objects/connections. 

Client.OnDataAvailable := ClientDataAvailable;

TWSocketServer also has an event OnDataAvailable, but that has _nothing to do
with the client object.


Arno
 

> 
>>> I  saw  in  online  ICS  help that OnClientConnect was place to assign
> 
> FP> This event is for TWSocketServer which instanciate a new 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

Reply via email to