At the time OnClientCreate is called, the socket is not assigned yet to the 
connection. So it is not easy to cancel the connection.
OnClientConnect is a better place. From there you can call Shutdown to 
terminate the connection you don't want.
Have a look at the source code for 
TCustomWSocketServer.TriggerSessionAvailable.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 01, 2007 5:51 PM
Subject: [twsocket] Cancelling TWSocketServer client connection


> Hello:
>    I am performing a series of steps when a new
> client connection is received (in the OnClientCreate
> event handler) which may cause the connection to
> become invalid (or unwelcomed, for various reasons).
> What would be the best way to drop the client
> session at this point?  Calling Client.Close does not
> seem to do anything, since the real connection
> doesn't seem to be ready until the OnClientConnect
> event is triggered.
>
>    After TriggerClientConnect() is called (the next
> step in the chain), the state of the client is
> checked, and whether the handler destroyed it, but
> nothing is checked after TriggerClientCreate() is
> called.  I was wondering if this is an oversight or
> if this is by design -- in which case, I should
> perform my checks on that event handler (?).  Seems
> to me that if the server decides to not accept the
> connection, I should be able to drop it as soon as
> possible.  Can anybody offer any suggestions?
>
>     Thanks,
>     -dZ.
>
>
> -- 
> 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