Question

Is there a proper way in Poco to abort a blocking I/O operation from another thread?

Was it helpful?

Solution

Since the thread doing the I/O would be blocked, I don't see any direct way of going in there an cancelling it, besides being nasty and killing the thread explicitly. This is however not advised

OTHER TIPS

Yes, you can call Socket::shutdown(). What happens after that depends on your platform, when recv() returns Poco will throw appropriate exception.

But you do not have to do blocking I/O to start with, since there is Poco::Net::Socket::setBlocking(bool) to enable or disable blocking behavior. Or, even if you want to do blocking, you can still define timeout using Poco::Net::Socket::setSendTimeout() or Poco::NetSocket::setReceiveTimeout()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top