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