Boost logo

Boost Users :

Subject: Re: [Boost-users] Convert asio::error_code into boost::system::error_code
From: Jens Weller (JensWeller_at_[hidden])
Date: 2012-03-22 07:31:29

> > I'm in a usecase, where we use a library, which brings its own asio lib
> with it:
> >
> > If this is correct, they're using asio 1.2 in its header only version.
> >
> > I've build an API which uses boost::asio to send data over the network.
> > One of our goals is now, to also include stun/turn, so we have to use
> this library.
> >
> > To enable the errorreporting, I need to convert the asio::error_code
> coming from reTurn to boost::system::error_code, so that I can call my notify
> method with it:
> > void notifyError(const boost::system::error_code& ec);
> >
> > any expierence in this? The constructors don't seem to fit, as
> error_category is in asio a enum, and in boost::system a class f.e.
> Just thinking out loud: wouldn't it be better to port the above
> library to a newer boost and boost.asio? It should take very little
> effort, but might result in much better interoperability, more simple
> further support, and better performance and stability (as a lot of
> things were fixed and improved since asio 1.2).

yes, underful thought.
BUT I ain't getting paid for this. Also the codebase is quite large, and internally they use 1.36, so I don't think porting is an easy task.
And its not my library, neither do I have time to convert etc.
All I want is to use it, as it seems to work.

As of now, I use boost::system::error_code(e.value(),generic_category()) which seems to get me a valid object.
But still I doubt that the conversion is correct, so I might just pipe the errormessage into my API instead of the full error_code object.


Jens Weller

NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at