I noticed that when the socket connection fails, it will trigger the onError callback, but in the next SocketReactor run cycle

Socket::select(readable, writable, except, _timeout)

throws an error, which causes the socketreactor thread (it was started in its own thread) to stop running. Is this the desired behavior?

Does that mean every Socketconnector instance needs its own dedicated SocketReactor?

And finally another question, in most papers where the connector-adaptor pattern is described, it is possible to have multiple ServiceHandlers connected to one Connector. Am I correct to assume that in the Poco implementation a socketconnector can only instantiate one ServiceHandler? (Since the connect can only happen in the SocketConnector constructor)

When you call Socket::select with 0 sockets, it will throw an exception. Shouldn't it just return 0 in that case? The docs state : "Returns the number of sockets ready."

Calling Socket::select with empty SocketLists is not useful, but it can happen. eg. You create a SocketReactor, and start it before adding the first SocketConnector is registered. Or the only ServiceHandler connected to a SocketReactor is closed by the remote host, causing the EventHandlers to be removed from the SocketReactor.

In these cases you arrive in a state where you think the SocketReactor is still running, but the run function has quit.

I am wondering if this is intended, and if so what is the appropriate way (order) to handle the above scenarios?

Poco::Timespan remainingTime(timeout);
^
I don't know if it is a valid fix, I didn't really check if it breaks other things, but with this code a socketreactor thread isn't quit when a connection error occurs on the only socketconnector.