Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio] async_read_until is passing no error and bytes_transferred of zero to handler
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-05-08 11:48:06


On 8 May 2014 at 14:21, Marcano, Gabriel E wrote:

> >> Based on my searching, the closest bugs to what I'm experiencing seem
> >> to be these ones:
> >> https://svn.boost.org/trac/boost/ticket/8933
> >> https://svn.boost.org/trac/boost/ticket/8967
> >
> > Have you not tried applying the patches these issues provide and see
> > what happens?
>
> I had not tried this earlier because I thought the patch proposed for
> ticket 8933 had been merged with the release branch. Upon checking,
> I noticed my assumption was incorrect. I patched my boost files and
> this did not solve my problem. I was hesitant to apply the patch from
> 8967 due to the discussion on that ticket (and it's invalid status),
> but I applied it now to test and it did not help either. I had to
> comment out a lot more on_pending calls that were not being commented
> out by the patch in order to get the patched code to compile. I can
> still reproduce the error.

Arse.

Ok, my last suggestion is to set num_threads=1 when constructing the
io_service.

Failing that, I am going to assume it is a bug in Windows. The serial
port drivers in Windows have always been flaky, indeed downright
broken from NT 3.5 up to Windows 2000. I'd search stackoverflow (e.g.
https://stackoverflow.com/questions/12583482/serial-asynchronous-i-o-i
n-windows-7-64) for serial port problems.

Just because it may have worked on an older ASIO means little.
Basically serial drivers on NT have always been brittle, you change
one small thing and they stop working in weird ways. An boss of mine
said "never use any serial API not used by HyperTerminal" and I think
he was right.

You might want to read the end of the page at
http://www.codeproject.com/Articles/992/Serial-library-for-C too,
*especially* the comments about trying to use a serial port handle
from more than one thread. Despite that being in 2003, there is no
reason to expect things have improved as I don't think serial port
drivers get a lot of love from Microsoft.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ 
http://ie.linkedin.com/in/nialldouglas/



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net