我是新手,我一直在尝试使用boost :: asio.问题是我在设置一些选项时总是会遇到"错误文件描述符"错误/异常(我需要将其设置为非阻塞).即便这样也失败了:
#include <boost/asio.hpp>
using boost::asio::ip::tcp;
int main( )
{
boost::asio::io_service io_service;
tcp::socket socket( io_service );
boost::asio::socket_base::non_blocking_io option(true);
socket.io_control( option );
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在运行期间弹出:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): Bad file descriptor
Run Code Online (Sandbox Code Playgroud)
当我尝试了一切时,这真的令人沮丧.如果重要,操作系统是Linux x64.