Boost C++ Libraries: Ticket #11721: boost::asio::serial_port bug in win10 https://svn.boost.org/trac10/ticket/11721 <p> 在最近写一些串口操作的程序时使用了 boost::asio::serial_port 来操作串口 但当尝试打开串口的时候出现了错误。下面是我的测试代码: </p> <div class="wiki-code"><div class="code"><pre><span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">io_service</span> <span class="n">_io_service</span><span class="p">;</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">devname</span> <span class="o">=</span> <span class="s">&quot;COM3&quot;</span><span class="p">;</span> <span class="k">try</span> <span class="p">{</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">serial_port</span> <span class="n">serial</span><span class="p">(</span><span class="n">_io_service</span><span class="p">);</span> <span class="n">serial</span><span class="p">.</span><span class="n">open</span><span class="p">(</span><span class="n">devname</span><span class="p">);</span><span class="c1">// throw error every times.</span> <span class="k">if</span> <span class="p">(</span><span class="n">serial</span><span class="p">.</span><span class="n">is_open</span><span class="p">())</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">devname</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; serial open successed.&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">devname</span> <span class="o">&lt;&lt;</span> <span class="s">&quot; serial open failed!&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">ex</span><span class="p">)</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">ex</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span><span class="c1">// GetLastError() == 87</span> <span class="p">}</span> </pre></div></div><p> 每次都会出现错误87。即 <a class="missing wiki">GetLastError</a>() 的结果为 87 于是跟进代码里面调试追到了 win_iocp_serial_port_service::open 函数里 </p> <p> win_iocp_serial_port_service::open 函数的实现如下: </p> <div class="wiki-code"><div class="code"><pre><span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span> <span class="n">win_iocp_serial_port_service</span><span class="o">::</span><span class="n">open</span><span class="p">(</span> <span class="n">win_iocp_serial_port_service</span><span class="o">::</span><span class="n">implementation_type</span><span class="o">&amp;</span> <span class="n">impl</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">device</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="o">&amp;</span> <span class="n">ec</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="n">is_open</span><span class="p">(</span><span class="n">impl</span><span class="p">))</span> <span class="p">{</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">already_open</span><span class="p">;</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">name</span> <span class="o">=</span> <span class="p">(</span><span class="n">device</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;\\&#39;</span><span class="p">)</span> <span class="o">?</span> <span class="nl">device</span> <span class="p">:</span> <span class="s">&quot;</span><span class="se">\\\\</span><span class="s">.</span><span class="se">\\</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">device</span><span class="p">;</span> <span class="o">::</span><span class="n">HANDLE</span> <span class="n">handle</span> <span class="o">=</span> <span class="o">::</span><span class="n">CreateFileA</span><span class="p">(</span><span class="n">name</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">GENERIC_READ</span> <span class="o">|</span> <span class="n">GENERIC_WRITE</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">OPEN_EXISTING</span><span class="p">,</span> <span class="n">FILE_FLAG_OVERLAPPED</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">handle</span> <span class="o">==</span> <span class="n">INVALID_HANDLE_VALUE</span><span class="p">)</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span> <span class="o">::</span><span class="n">DCB</span> <span class="n">dcb</span><span class="p">;</span> <span class="n">memset</span><span class="p">(</span><span class="o">&amp;</span><span class="n">dcb</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">DCB</span><span class="p">));</span> <span class="n">dcb</span><span class="p">.</span><span class="n">DCBlength</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">DCB</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">GetCommState</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dcb</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fBinary</span> <span class="o">=</span> <span class="n">TRUE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fDsrSensitivity</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fNull</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fAbortOnError</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">SetCommState</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dcb</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span><span class="c1">// lee: error is here!!!</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="o">::</span><span class="n">COMMTIMEOUTS</span> <span class="n">timeouts</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadIntervalTimeout</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadTotalTimeoutMultiplier</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadTotalTimeoutConstant</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">WriteTotalTimeoutMultiplier</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">WriteTotalTimeoutConstant</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">SetCommTimeouts</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">timeouts</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="k">if</span> <span class="p">(</span><span class="n">handle_service_</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">impl</span><span class="p">,</span> <span class="n">handle</span><span class="p">,</span> <span class="n">ec</span><span class="p">))</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> 发现每次在第一次 <a class="missing wiki">SetCommState</a> 的时候总是会报错并离开。 于是查看了前面通过 <a class="missing wiki">GetCommState</a> 获取到的 dcb 的值。 发现 dcb.<a class="missing wiki">BaudRate</a> == 0 时无法 <a class="missing wiki">SetCommState</a> 成功 也就是说在有些设备中获取不到 dcb.<a class="missing wiki">BaudRate</a> 这个值。 </p> <h2 class="section" id="下面是我自己的解决办法">下面是我自己的解决办法:</h2> <p> 在 win_iocp_serial_port_service.ipp 文件的88行左右添加 </p> <div class="wiki-code"><div class="code"><pre><span class="k">if</span> <span class="p">(</span><span class="n">dcb</span><span class="p">.</span><span class="n">BaudRate</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="n">dcb</span><span class="p">.</span><span class="n">BaudRate</span> <span class="o">=</span> <span class="mi">115200</span><span class="p">;</span> </pre></div></div><p> 修改后的 win_iocp_serial_port_service::open 函数完整代码如下: </p> <div class="wiki-code"><div class="code"><pre><span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span> <span class="n">win_iocp_serial_port_service</span><span class="o">::</span><span class="n">open</span><span class="p">(</span> <span class="n">win_iocp_serial_port_service</span><span class="o">::</span><span class="n">implementation_type</span><span class="o">&amp;</span> <span class="n">impl</span><span class="p">,</span> <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">device</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="o">&amp;</span> <span class="n">ec</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="n">is_open</span><span class="p">(</span><span class="n">impl</span><span class="p">))</span> <span class="p">{</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">already_open</span><span class="p">;</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">name</span> <span class="o">=</span> <span class="p">(</span><span class="n">device</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;\\&#39;</span><span class="p">)</span> <span class="o">?</span> <span class="nl">device</span> <span class="p">:</span> <span class="s">&quot;</span><span class="se">\\\\</span><span class="s">.</span><span class="se">\\</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">device</span><span class="p">;</span> <span class="o">::</span><span class="n">HANDLE</span> <span class="n">handle</span> <span class="o">=</span> <span class="o">::</span><span class="n">CreateFileA</span><span class="p">(</span><span class="n">name</span><span class="p">.</span><span class="n">c_str</span><span class="p">(),</span> <span class="n">GENERIC_READ</span> <span class="o">|</span> <span class="n">GENERIC_WRITE</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">OPEN_EXISTING</span><span class="p">,</span> <span class="n">FILE_FLAG_OVERLAPPED</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">handle</span> <span class="o">==</span> <span class="n">INVALID_HANDLE_VALUE</span><span class="p">)</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span> <span class="o">::</span><span class="n">DCB</span> <span class="n">dcb</span><span class="p">;</span> <span class="n">memset</span><span class="p">(</span><span class="o">&amp;</span><span class="n">dcb</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">DCB</span><span class="p">));</span> <span class="n">dcb</span><span class="p">.</span><span class="n">DCBlength</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">DCB</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">GetCommState</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dcb</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fBinary</span> <span class="o">=</span> <span class="n">TRUE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fDsrSensitivity</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fNull</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="n">dcb</span><span class="p">.</span><span class="n">fAbortOnError</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="n">dcb</span><span class="p">.</span><span class="n">BaudRate</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="n">dcb</span><span class="p">.</span><span class="n">BaudRate</span> <span class="o">=</span> <span class="mi">115200</span><span class="p">;</span> <span class="c1">// add lee 2015.10.10. 解决dcb.BaudRate为0时无法成功SetCommState的BUG</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">SetCommState</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dcb</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="o">::</span><span class="n">COMMTIMEOUTS</span> <span class="n">timeouts</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadIntervalTimeout</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadTotalTimeoutMultiplier</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">ReadTotalTimeoutConstant</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">WriteTotalTimeoutMultiplier</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">timeouts</span><span class="p">.</span><span class="n">WriteTotalTimeoutConstant</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="o">!::</span><span class="n">SetCommTimeouts</span><span class="p">(</span><span class="n">handle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">timeouts</span><span class="p">))</span> <span class="p">{</span> <span class="n">DWORD</span> <span class="n">last_error</span> <span class="o">=</span> <span class="o">::</span><span class="n">GetLastError</span><span class="p">();</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="n">ec</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="p">(</span><span class="n">last_error</span><span class="p">,</span> <span class="n">boost</span><span class="o">::</span><span class="n">asio</span><span class="o">::</span><span class="n">error</span><span class="o">::</span><span class="n">get_system_category</span><span class="p">());</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> <span class="k">if</span> <span class="p">(</span><span class="n">handle_service_</span><span class="p">.</span><span class="n">assign</span><span class="p">(</span><span class="n">impl</span><span class="p">,</span> <span class="n">handle</span><span class="p">,</span> <span class="n">ec</span><span class="p">))</span> <span class="o">::</span><span class="n">CloseHandle</span><span class="p">(</span><span class="n">handle</span><span class="p">);</span> <span class="k">return</span> <span class="n">ec</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><h2 class="section" id="测试环境">测试环境</h2> <table class="wiki"> <tr><th> 说明 </th><th> 参数 </th></tr><tr><td> 操作系统 </td><td> Windows10 专业版 x64 </td></tr><tr><td> 开发环境 </td><td> Microsoft Visual Studio Community 2013 Version 12.0.40629.00 Update 5 </td></tr><tr><td> Boost版本 </td><td> boost_1.59.0 </td></tr></table> <h2 class="section" id="结束语">结束语</h2> <p> 以上只是自己的猜测,并不一定是完全正确的。如有任何错误,请联系并告诉我。我将尽快修改,不胜感激。 </p> <h2 class="section" id="我的原文">我的原文</h2> <p> <a class="ext-link" href="http://www.leelib.com/2015/10/10/win10-boost-asio-serial-port-bug.html"><span class="icon">​</span>http://www.leelib.com/2015/10/10/win10-boost-asio-serial-port-bug.html</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11721 Trac 1.4.3