So I was wondering, what is the standard way to handle sending data with the Poco Reactor.
Currently what I'm doing is when I have data that needs to be sent I will register for WritableNotification, send my data in the event handler when it is called, then unregister the handler. Keeping WritableNotification registered the whole time results in 100% CPU usage.
This works fine, except that it results in some latency as we wait for the event handler to be called. On a typical Windows consumer system, the round-trip latency is about 30ms when using this method. Most likely this is because of the use of select in the main reactor thread, and the low timer resolution on these versions of Windows. On Windows Server 2008, there is no real latency if we set the reactor timeout value to 1ms. This is with the client and server on the same machine, or even in the same process.
I think writing to raw sockets is typically thread safe, is it safe to write to Poco sockets in the Reactor framework from worker threads?