id summary reporter owner description type status milestone component version severity resolution keywords cc 3796 """Unhandled exception"" with boost::asio library in vs2010 beta 2" sumandeng@… chris_kohlhoff "I have a code snipper using boost::asio library, it runs well complied with vs2008, but occurs error compiled with vs2010 beta 2, just like this: ""Unhandled exception at 0x012ec084 in SimpleC++.exe: 0xC0000005: Access violation reading location 0x00000000."" see code below: #include ""stdafx.h"" #include #include #include #include using namespace std; using boost::asio::ip::tcp; std::string make_header() { std::string str =""""; str += ""GET / HTTP/1.1\n""; str += ""Host: www.google.com\n""; str += ""User-Agent: Mozilla/5.0\n""; str += ""Accept: */*\n""; str += ""Accept-Encoding: gzip,deflate\n""; str += ""\n\n""; return str; } int main(int argc, char* argv[]) { boost::asio::io_service io_service; tcp::resolver resolver(io_service); boost::asio::ip::tcp::resolver::query query(""www.google.cn"", ""http""); tcp::resolver::iterator endpoint_iterator = resolver.resolve(query); tcp::resolver::iterator end; tcp::socket socket(io_service); boost::system::error_code error = boost::asio::error::host_not_found; while (error && endpoint_iterator != end) { socket.close(); socket.connect(*endpoint_iterator, error); } if (error) throw boost::system::system_error(error); std::string message = make_header(); cout << message << ""\n""; try { size_t len = socket.send(boost::asio::buffer(message)); cout << ""send: "" << len << ""\n""; } catch (std::exception e) { cout << e.what() << std::endl; } size_t l = 0; for (;;) { boost::array buf; size_t len = socket.read_some(boost::asio::buffer(buf), error); if (error==boost::asio::error::eof) break; else if (error) throw boost::system::system_error(error); l += len; std::cout.write(buf.data(), len); } std::cout <