To prevent unresponsive servers from indefinitely hanging a program, the urdl::istream class uses a timeout when opening the stream and when reading content.
urdl::istream is; // Fail if the URL cannot be opened within 60 seconds. is.open_timeout(60000); is.open("http://somehost/path"); if (!is) { // If the open operation timed out then: // is.error() == boost::system::errc::timed_out // holds true. } ... // Fail if an individual read does not complete within 30 seconds. is.read_timeout(30000); // From here on, use urdl::istream like any other std::istream object. std::string line; while (std::getline(is, line)) { std::cout << line << std::endl; } // If a read operation timed out then: // is.error() == boost::system::errc::timed_out // holds true.