We have a client/server application developed using Poco socket APIs.
On the client side, there are the following codes to add call backs to
readable and error event callbacks:
Poco::Net::SocketReactor clientReactor;
Poco::NObserver<ClientController, Poco::Net::ReadableNotification> obs(*this, &ClientController::onReadable );
Poco::NObserver<ClientController, Poco::Net::ErrorNotification> obsError(*this, &ClientController::onSocketError);
...
/*socket is a pointer of Poco::Net::StreamSocket type*/
clientReactor.addEventHandler(*socket, obs);
clientReactor.addEventHandler(*socket, obsError);
Poco::Thread notificationThread;
notificationThread.start(clientReactor);
I found that when the server is shutdown with a CTRL-C, a 'kill -9' or a network interface restart,
the ErrorNotification event did not get fired. Instead, the ReadableNotification event gets fired,
and the receiveBytes() on socket returns 0 bytes, which implies a socket shutdown.
How can a socket error condition be produced which causes the ErrorNotification event to be fired?
Thank you!





