poco icon indicating copy to clipboard operation
poco copied to clipboard

Throw Error in Socket::available if Socket Error Occurs

Open andrewauclair opened this issue 1 year ago • 1 comments

Changes to help address the issues I was seeing in #4537. This change makes SocketImpl::available throw an error exception if the result of recvfrom is negative and there was a socket error for UDP sockets. This will correctly inform the calling code that the socket is invalid and needs to be reset. This also fixes the issue with receiveBytes throwing std::bad_array_new_length because it will instead throw a Poco exception first when calling available.

andrewauclair avatar Apr 25 '24 12:04 andrewauclair

I can change it back and throw exceptions in places that poco calls available. If that's what you want. I do feel that the exception forces the issue better. But I agree with your statement about querying functions.

andrewauclair avatar Jul 30 '24 10:07 andrewauclair