Tcp boost beast websocket服务器读取,错误代码为文件结束,操作已取消
我正在尝试设置websocket服务器,如中所述 一切正常,除了websocket流读取抛出未指定的系统错误,错误代码为“文件结束”和“操作已取消”Tcp boost beast websocket服务器读取,错误代码为文件结束,操作已取消,tcp,websocket,asio,boost-beast,Tcp,Websocket,Asio,Boost Beast,我正在尝试设置websocket服务器,如中所述 一切正常,除了websocket流读取抛出未指定的系统错误,错误代码为“文件结束”和“操作已取消” 我在谷歌上搜索过,文件结尾可能是由于底层tcp套接字关闭造成的,但问题是断开连接的情况经常发生,这没有意义。究竟什么会导致操作取消系统错误 原来是网络不好造成的。当我禁用一些VPN时,问题就消失了 beast::flat_buffer buffer; try { ws->read(buffer); // ws is in the fr
我在谷歌上搜索过,文件结尾可能是由于底层tcp套接字关闭造成的,但问题是断开连接的情况经常发生,这没有意义。究竟什么会导致操作取消系统错误 原来是网络不好造成的。当我禁用一些VPN时,问题就消失了
beast::flat_buffer buffer;
try {
ws->read(buffer); // ws is in the free store
}
catch(beast::system_error const& se) {
if(se.code() == websocket::error::closed) {
LOG_INFO << "ws closed, exiting handing thread..";
break;
}
LOG_WARNING << "exception: " << se.code() << ", " << se.code().message();
}
WARNING exception: asio.misc:2, End of file
WARNING exception: system:125, Operation canceled
WARNING exception: system:125, Operation canceled
WARNING exception: system:125, Operation canceled