1
在下面的代码中,我想用通用的boost系统错误代码替换Windows WinSock错误WSAEINTR = 10004,但是如何将我在调试器中找到的代码与泛型枚举进行映射?如何将Windows系统错误代码映射到boost :: error_condition?
timeout_.expires_from_now(posix_time::seconds(15));
timeout_.async_wait(boost::bind(&cancel_socket_fn,this,_1));
asio::streambuf rd_buf;
unsigned length = read_until(socket_, rd_buf,delimiter_string, error);
timeout_.cancel();
if(error)
{
// how do I make this portable?
if(error.value()==WSAEINTR) throw request_timeout_exception()
else throw my_asio_exception(error,"Unable to read header");
}
...
cancel_socket_fn(system::error_code e) { socket_.cancel(); }