I am experimenting with the Poco C++ Libraries v1.3.2 with excellent results.
At the moment, I am implementing a ServiceHandler based on the use of StreamSocket and SocketReactor. I am using EchoServer as an example.
I want to limit the number of simultaneous connections to perhaps three. I do this by maintaining an instance counter in my ServiceHandler constructor, and if max connections has been reached, I 'delete this' to close the connection based on the onShutdown example in EchoServer.
It works great. But I am a little nervous about calling 'delete this' within the constructor context for the same object.
Is that safe?
Is there a better way to detect the connection attempt via the Poco framework and close the connection based on an instance counter or other application constraint?