• <small id='dMrUc'></small><noframes id='dMrUc'>

  • <i id='dMrUc'><tr id='dMrUc'><dt id='dMrUc'><q id='dMrUc'><span id='dMrUc'><b id='dMrUc'><form id='dMrUc'><ins id='dMrUc'></ins><ul id='dMrUc'></ul><sub id='dMrUc'></sub></form><legend id='dMrUc'></legend><bdo id='dMrUc'><pre id='dMrUc'><center id='dMrUc'></center></pre></bdo></b><th id='dMrUc'></th></span></q></dt></tr></i><div id='dMrUc'><tfoot id='dMrUc'></tfoot><dl id='dMrUc'><fieldset id='dMrUc'></fieldset></dl></div>

      • <bdo id='dMrUc'></bdo><ul id='dMrUc'></ul>
    1. <tfoot id='dMrUc'></tfoot>

        <legend id='dMrUc'><style id='dMrUc'><dir id='dMrUc'><q id='dMrUc'></q></dir></style></legend>

        你能在 boost asio 中设置 SO_RCVTIMEO 和 SO_SNDTIMEO 套接字选项吗?

        时间:2023-07-19

        <i id='UOZ5e'><tr id='UOZ5e'><dt id='UOZ5e'><q id='UOZ5e'><span id='UOZ5e'><b id='UOZ5e'><form id='UOZ5e'><ins id='UOZ5e'></ins><ul id='UOZ5e'></ul><sub id='UOZ5e'></sub></form><legend id='UOZ5e'></legend><bdo id='UOZ5e'><pre id='UOZ5e'><center id='UOZ5e'></center></pre></bdo></b><th id='UOZ5e'></th></span></q></dt></tr></i><div id='UOZ5e'><tfoot id='UOZ5e'></tfoot><dl id='UOZ5e'><fieldset id='UOZ5e'></fieldset></dl></div>

        <small id='UOZ5e'></small><noframes id='UOZ5e'>

        <legend id='UOZ5e'><style id='UOZ5e'><dir id='UOZ5e'><q id='UOZ5e'></q></dir></style></legend>
          <bdo id='UOZ5e'></bdo><ul id='UOZ5e'></ul>
          <tfoot id='UOZ5e'></tfoot>
            <tbody id='UOZ5e'></tbody>

                • 本文介绍了你能在 boost asio 中设置 SO_RCVTIMEO 和 SO_SNDTIMEO 套接字选项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  你能在 boost asio 中设置 SO_RCVTIMEO 和 SO_SNDTIMEO 套接字选项吗?

                  can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio?

                  如果有,怎么办?

                  注意我知道你可以使用定时器来代替,但我想特别了解这些套接字选项.

                  Note I know you can use timers instead, but I'd like to know about these socket options in particular.

                  推荐答案

                  当然可以!Boost ASIO 允许您访问本机/底层数据,在这种情况下是 SOCKET 本身.所以,假设您有:

                  Absolutely! Boost ASIO allows you to access the native/underlying data, which in this case is the SOCKET itself. So, let's say you have:

                  boost::asio::ip::tcp::socket my_socket;
                  

                  假设您已经调用了 openbind 或一些实际上使 my_socket 可用的成员函数.然后,要获取底层 SOCKET 值,请调用:

                  And let's say you've already called open or bind or some member function that actually makes my_socket usable. Then, to get the underlying SOCKET value, call:

                  SOCKET native_sock = my_socket.native();
                  int result = SOCKET_ERROR;
                  
                  if (INVALID_SOCKET != native_sock)
                  {
                      result = setsockopt(native_sock, SOL_SOCKET, <the pertinent params you want to use>);
                  }
                  

                  所以你有它!Boost 的 ASIO 使您可以比其他方式更快地完成许多事情,但仍有很多事情您仍然需要正常的套接字库调用.这恰好是其中之一.

                  So there you have it! Boost's ASIO lets you do many things more quickly than you otherwise might be able to, but there are a lot of things you still need the normal socket library calls for. This happens to be one of them.

                  这篇关于你能在 boost asio 中设置 SO_RCVTIMEO 和 SO_SNDTIMEO 套接字选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:CMake:如何使用相关目录添加 Boost.Test 用例? 下一篇:windows在c++中读取快捷方式文件的目标

                  相关文章

                    <small id='6RlbZ'></small><noframes id='6RlbZ'>

                    <tfoot id='6RlbZ'></tfoot>
                    • <bdo id='6RlbZ'></bdo><ul id='6RlbZ'></ul>
                  1. <i id='6RlbZ'><tr id='6RlbZ'><dt id='6RlbZ'><q id='6RlbZ'><span id='6RlbZ'><b id='6RlbZ'><form id='6RlbZ'><ins id='6RlbZ'></ins><ul id='6RlbZ'></ul><sub id='6RlbZ'></sub></form><legend id='6RlbZ'></legend><bdo id='6RlbZ'><pre id='6RlbZ'><center id='6RlbZ'></center></pre></bdo></b><th id='6RlbZ'></th></span></q></dt></tr></i><div id='6RlbZ'><tfoot id='6RlbZ'></tfoot><dl id='6RlbZ'><fieldset id='6RlbZ'></fieldset></dl></div>

                    <legend id='6RlbZ'><style id='6RlbZ'><dir id='6RlbZ'><q id='6RlbZ'></q></dir></style></legend>