What I ended up doing (Which I'll spit out here just in case anyone else 
ever runs into the same situation .. Or maybe theres a better way):

First define 2 variables..

chatform.socket : pointer;
chatform.connected : boolean;

Then set the chatform variables

mainform.ConnectToServerClick()

   if not assigned(chatform.socket) then
     chatform.socket := @WSocket1;

mainform.WSocket1.OnSessionConnected()

   chatform.connected := true;


mainform.WSocket1.OnSessionClosed()

   chatform.connected := false;

Then, finally, in the chatform, when the user does something and needs 
to send data..

if assigned(socket) and connected then
   TWSocket(socket).sendstr(s);

Haven't stress tested it or anything yet, but it works well in my 
testing so far.

Wilfried Mestdagh wrote:
> Hello Michael,
> 
> You dont need to replicate it. Just leave the Socket where it is. In
> your second form you can have a socket that points to the other socket.
> Dont drop one on the second form, but just (I called the socket Cli):
> 
> SecondForm.Cli := MainForm.Cli;
> 
> and then you call all in the Cli of the second form witch points to the
> Cli of the mail form.
> 
> An object variable is just a pointer to the actual object, so you can as
> many pointers to the same object as you wants.
> 
> ---
> Rgds, Wilfried [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> http://www.mestdagh.biz
...
>> Is this the right way to go? If so, whats the better way to make this work?

-- 
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