<< See TTcpSrvForm.WSocketServer1ClientConnect in TcpSrv1.pas source.>>

When I try to use that code, I get an EInvalidCast error, specifically,
"EInvalidCast - Invalid class typecast" on this line:

  with Client as TTcpSrvClient do begin

of the OnClientConnect() event handler.

And this even though my class definition and OnClientConnect() code were
copied verbatim from the TcpSrv1.pas.

I have also copied most of the code from the TcpSrv1 unit, including but not
limited to:

    procedure ClientDataAvailable(Sender: TObject; Error: Word);
    procedure ClientBgException(Sender       : TObject;
                                E            : Exception;
                                var CanClose : Boolean);
    procedure ClientLineLimitExceeded(Sender        : TObject;
                                      Cnt           : LongInt;
                                      var ClearData : Boolean);
    procedure WMAppStartup(var Msg: TMessage); message WM_APPSTARTUP;

Why would I get EInvalidCast when TcpSrv doesn't, although the cast and the
custom class are the same?


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Francois PIETTE
Sent: Monday, November 20, 2006 2:19 PM
To: ICS support mailing
Subject: Re: [twsocket] Which TWSocketServer event to capture data sent?

> Which TWSocketServer event should I code to retrieve incoming data?

None !
Data doesn't come from TWSocketServer but from one TWSocketClient (another 
TWSocket derived class) which is instanciated for each incomming connection.

See how it works in TcpSrv sample program.

> The two that fire when I send the data are:
> 1)       WSocketServerSessionAvailable()
> 2)       WSocketServerClientConnect()

Normal for a listening socket.

> It seems the WSocketServerDataAvailable() and/or WSocketServerDataSent()
> events should fire.

Defenitely not !

> Do I need to do anything with the TWSocketServer
> component to get these to fire, or can I safely read the incoming data in
> one of the two events above (Once a connection is made, data will be sent
> multiple times, so I don't know if those events get called over and over,
> or.?

See TTcpSrvForm.WSocketServer1ClientConnect in TcpSrv1.pas source. This 
event handler associate an OnDataAvailable event handler to the 
TWSocketClient instance created by the server component to handle a client 
connection.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
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

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited.   If you are not the intended
recipient, please contact the sender and delete the material from any
computer.
-- 
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