<<> Why would I get EInvalidCast when TcpSrv doesn't, although the cast and the > custom class are the same?
Maybe a typo error ?>> No, all that code was copied-and-pasted from TCPSrv1.pas. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francois Piette Sent: Tuesday, November 21, 2006 1:52 AM To: ICS support mailing Subject: Re: [twsocket] Which TWSocketServer event to capture data sent? > << 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. TWSocketServer instanciate a new TWSocket component for each incomming connection. The exact class instanciated is governed by TWSocketServer.ClientClass. As you can see in TcpSrv sample program, you have to define your own class (TTcpSrvClient in the demo) deriving form TWSocketClient and having all the features you need to handle YOUR client connection. In all event handlers, TWSocketServer pass a "Client" argument of the base type TWSocketClient which you must cast to YOUR type. > Why would I get EInvalidCast when TcpSrv doesn't, although the cast and the > custom class are the same? Maybe a typo error ? Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
