Boost C++ Libraries: Ticket #4170: Error using null_buffers in async_send_to in Windows https://svn.boost.org/trac10/ticket/4170 <p> While exploring the boost.asio library I came across a bug caused by a typo in one of the header files. When async_send_to is invoked on an UDP socket with null_buffers, the following sequence of calls takes place: </p> <ol><li><code>basic_datagram_socket-&gt;async_send_to(const ConstBufferSequence&amp; buffers, const endpoint_type&amp; destination, WriteHandler handler)</code> </li><li><code>datagram_socket_service-&gt;async_send_to(implementation_type&amp; impl, const ConstBufferSequence&amp; buffers, const endpoint_type&amp; destination, socket_base::message_flags flags, WriteHandler handler)</code> </li><li><code>win_iocp_socket_service-&gt;async_send_to(implementation_type&amp; impl, const ConstBufferSequence&amp; buffers, const endpoint_type&amp; destination, socket_base::message_flags flags, Handler handler)</code> </li></ol><p> The problem is, the 3rd function is the generic version of async_send_to() which expects a valid buffer. Passing null_buffers causes an error. </p> <p> There is also a specialization of async_send_to() for the null_buffers case. Unfortunately, it's never called, because in the declaration some arguments are out of place. The declaration is: <code>async_send_to(implementation_type&amp; impl, const null_buffers&amp;, socket_base::message_flags, const endpoint_type&amp;, Handler handler)</code>. Compared to the generic version, the <code>flags</code> and <code>destination</code> arguments are swapped. After correcting the order of these two arguments, async_send_to() works as expected. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4170 Trac 1.4.3 anonymous Thu, 29 Apr 2010 22:56:50 GMT milestone changed https://svn.boost.org/trac10/ticket/4170#comment:1 https://svn.boost.org/trac10/ticket/4170#comment:1 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">Boost 1.44.0</span> </li> </ul> <p> Thanks for the report. I see that the problem also applies to non-windows platforms. </p> <p> Note that async_send_to/null_buffers isn't especially useful anyway. You can just use async_send instead, as the destination is ignored in any case. </p> Ticket chris_kohlhoff Wed, 09 Jun 2010 09:41:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4170#comment:2 https://svn.boost.org/trac10/ticket/4170#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62644" title="Merge from trunk. ........ r62497 | chris_kohlhoff | 2010-06-07 ...">[62644]</a>) Merge from trunk. </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62497" title="Fix handling of small but non-zero timeouts. Fixes #4205. ">r62497</a> | chris_kohlhoff | 2010-06-07 09:28:58 +1000 (Mon, 07 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix handling of small but non-zero timeouts. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4205" title="#4205: Bugs: Excessive CPU using in run_one in ASIO (closed: fixed)">#4205</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62499" title="Reworked implementation MkII ">r62499</a> | chris_kohlhoff | 2010-06-07 10:00:45 +1000 (Mon, 07 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Reworked implementation MkII. Also fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4170" title="#4170: Bugs: Error using null_buffers in async_send_to in Windows (closed: fixed)">#4170</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62530" title="Fixes for MSVC 7.1, Borland. ">r62530</a> | chris_kohlhoff | 2010-06-08 09:24:28 +1000 (Tue, 08 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fixes for MSVC 7.1, Borland. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62531" title="Some changes for Symbian support. ">r62531</a> | chris_kohlhoff | 2010-06-08 09:29:05 +1000 (Tue, 08 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Some changes for Symbian support. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62549" title="Fix typo in tutorial. Refs #4252. ">r62549</a> | chris_kohlhoff | 2010-06-08 14:27:26 +1000 (Tue, 08 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix typo in tutorial. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4252" title="#4252: Bugs: Typoo in boost::asio tutorial (closed: fixed)">#4252</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62556" title="Ensure unsigned char is used with isdigit. Refs #4201. ">r62556</a> | chris_kohlhoff | 2010-06-08 19:01:39 +1000 (Tue, 08 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Ensure unsigned char is used with isdigit. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4201" title="#4201: Bugs: boost/asio/detail/socket_ops.hpp:1305: isdigit called with char, not ... (closed: fixed)">#4201</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/62558" title="Fix handling of empty buffer sequences. ">r62558</a> | chris_kohlhoff | 2010-06-08 21:01:57 +1000 (Tue, 08 Jun 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix handling of empty buffer sequences. </p> </blockquote> <p> ........ </p> Ticket