Let someone send a message to my socket, he accepts it with the function receive_from(asio::buffer(buffer, size), SenderEndPoint) , where SenderEndPoint from boost::asio::ip::udp::endpoint . Then, I reply via send_to(asio::buffer(buffer2), SenderEndPoint) for the same SenderEndPoint .
But there is one problem: if the one who initially sent the message closed the socket, the program crashes with an exception. I tried to surround the try-catch sending with exceptions from both std::exception and boost::exception , but for some reason this exception is caught by a much higher top try-catch from the main (this whole thing I described above occurs in the class object ).
Is it possible to somehow make a check on the availability of the socket from the sender, if boost::asio::ip::udp::socket for receiving and sending on my side?