Programming => Networking and Web Programming => Topic started by: zamronypj on June 23, 2019, 06:45:27 am

Title: How to keep client connection open after handling TSocketServer OnConnect event
Post by: zamronypj on June 23, 2019, 06:45:27 am

Please correct me if I am wrong.

Source code of TServerSocket class (

tells me that when we handle its OnConnect event, it is developer's responsibility to free socket stream instance when they are done, otherwise we will leak memory.
Freeing socket stream will cause client socket connection to be closed.

Due to network protocol requirement, sometime my server application is required to leave client socket connection open after server application done sending data to client (the client will be responsible to close socket connection). In this condition, it becomes problematic, not freeing socket stream leading to memory leak, but freeing socket cause server application not conform network protocol.

How do I solve this without need to create new classes inherited from TInetServer/TUnixServer and also TInetSocket/TUnixSocket?

I solved it by implementing my own socket server. See my related post,45972.0.html
TinyPortal © 2005-2018