Hello Dod,

First of all you mentions 'OnClientDataAvailable'. Yo do mean
OnDataAvailable event ???

> MySocket:=TWSocket.Create(nil);
> MySocket.OnClientConnect:=MyOnClientConnect;
> MySocket.OnClientDataAvailable:=MyOnClientDataAvailable;

Thats correct and in most case a good programming technique. Mostly I
assign all event handlers also right after creation of a component.

> Then it seems the OndataAvailable will never trigger.
> But if I put MySocket.OnClientDataAvailable:=MyOnClientDataAvailable
> inside the MyOnClientConnect, then it will work correctly.

You probably change something else too. It does not matter where you
assign OnDataAvailable, as long as it is before data is available.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Wednesday, February 15, 2006, 14:51, Dod wrote:

> 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

Reply via email to