pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.04k stars 2.11k forks source link

Throw Error in Socket::available if Socket Error Occurs #4539

Open andrewauclair opened 2 months ago

andrewauclair commented 2 months ago

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.