boost-asio

Extend asynchronous file io in boost::asio to Mac OS X

The boost::asio package contains classes for doing asynchronous file io in Windows using IO completion ports. To my understanding, there is no support for asynchronous file io for other platforms included in the asio package. I am wondering what would need to be done in order to extend asio with asynchronous file io support for at least...

Using boost.asio in cMake

I am relatively new to cMake, and I'm trying use the boost asio library in my project. I was able to get cMake to find other boost libraries such as smart_ptr and lexical_cast, but I get a linker error when I try to include boost/asio.hpp: LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-1_40.lib'. I then tr...

Multiple writes in boost::asio to a single socket

I couldn't find any thing about what happens if you try to do a second write to a boost::asio socket before a previous one completed. This seems like something that could potentially happen in many asynchronous programs (since after doing the first write, the program will then continue before waiting for it to finish, potentially causing...

Asynchronous write to socket and user values (boost::asio question)

Hello, I'm pretty new to boost. I needed a cross platform low level C++ network API, so I chose asio. Now, I've successfully connected and written to a socket, but since I'm using the asynchronous read/write, I need a way to keep track of the requests (to have some kind of IDs, if you will). I've looked at the documentation/reference, a...

Boost::bind a method with boost::function parameter

I would like to provide an extra boost::function to a async_write. I want the connections own HandleWrite function to be called first and then call the provided boost::function. Member method of Connection that binds to asio async_write void Connection::HandleWrite( const boost::system::error_code& e, boost::function<void (con...

Release socket in Boost.Asio (opposite of assign), or not transfer ownvership

Hello, There is a function assign in Boost.Asio sockets, however I'm looking for something like release/unassign that would transfer the ownership on socket back to user. or some type of assign that would not transfer ownership to socket class, so it would not close it when destroyed. I'm aware of this solution but it involves d...

boost::asio extraction with bcp and no threads

I want to use boost::asio in a project by itself. I am not using threads, but when I use bcp to extract asio it pulls out ALOT of code including the thread stuff. How can I use bcp to only pull out what I need for simple single threaded socket routines? ...

Which boost libraries are heading for TR2?

If found this quote at boost.org: More Boost libraries are in the pipeline for TR2 It links to the TR2 call from proposals. But I can't seem to find any other information on which boost libraries are headed for TR2. I've seen a draft proposal for Boost.Asio, and I vaguely remember seeing something about Boost.System and Boost.Fil...

Using Mysql blocking API with Boost::asio

I am building a aync single threaded server that receives data from clients. It processes the data and then saves it to the MySQL Database. The problem is that, MySQL C API does not support non-blocking calls and asio mainly does not like blocking calls. So I am thinking something like Python Twisted's deferToThread() like semantics. I...

What is the difference between asio::tcp::socket's async_read_some and async_receive?

What is the difference between: boost::asio::tcp::socket::async_read_some() boost::asio::tcp::socket::async_receive() As far as I can tell their documentation is identical. Which should I prefer? ...

Help streaming over http in C++

I'm looking to use a web service that offers a streaming api. This api can typically be used by the java method java.net.URL.openStream(); Problem is I am trying to design my program in C++ and have no idea what libraries (I've heard the cUrl library is very good at this sort of thing) to use, or how to use them to do what I want. The...

Boost.ASIO-based HTTP client library (like libcurl)

I am looking for a modern C++ HTTP library because libcurl's shortcomings are difficult to work around by C++ wrappers. Solutions based on Boost.ASIO, which has become the de-facto C++ TCP library, are preferred. ...

How to reduce compilation times with Boost Asio

Boost.Asio is great library but it has one huge drawback -- extreamly slow compilation times. A simple implementation (really simple) of HTTP protocol (about 1k lines of code) requires about 13.5s to compile under GCC 4.4! I tryed to use PCH but it does not improve compilation times too much (about 1s. only). So are there any tutorials...

Compiling and Executing Boost.Asio code with OpenMPI

Hello, I am trying to write a program which runs using OpenMPI on our cluster and communicates the results using TCP/IP to another machine which has a network connection to the cluster. I am using Boost.Asio for the TCP/IP connection. The problem I am facing is that if I remove the OpenMPI from the executable and compile it with g++ it ...

Remove all handlers from a boost::asio::io_service without calling them.

I want to remove all handlers from an IO_service right before I reuse it. Is this possible? I'm writing unit tests that involve an asio::io_service. In between each test case I want to clear the handlers from the global io_service. I thought that io_service::reset would to that but it doesn't. reset() only allows the io_service to b...

boost::asio: thread local asynchronous events.

I will be creating x amount of threads in my server-app. x will be the amount of cores on the machine, and these threads will be (non-hyperthread) core-bound. Naturally with this scheme I would like to distribute incoming connections across the threads with the aim of ensuring that once a connection is assigned to a thread, it will only ...

Boost asio io_service dispatch vs post

Can anyone tell me the difference between io_service dispatch and post? It was not clear to me what is more suitable for my problem. I need to invoke a handler inside another handler and I don't what invoker to use. Thanks. ...

Undefined references when including boost library

I am trying to use boost's asio library, but I keep getting undefined references. I'm on Dev-Cpp on Windows, which is using the G++ compiler. I installed boost using the installer from boostpro computing for Boost 1.42.0 [link]. Here is the code of the test program I am trying to make: #include <boost/asio.hpp> #include <iostream> i...

For distributed applications, which to use, ASIO vs. MPI?

I am a bit confused about this. If you're building a distributed application, which in some cases may perform parallel operations (although not necessarily mathematical), should you use ASIO or something like MPI? I take it MPI is a higher level than ASIO, but it's not clear where in the stack one would begin. ...

Does boost::asio::deadline_timer use a thread for each timer?

I have a list of items that I need to update on different intervals. The list can grow to be thousands of items long. Each item could potentially have a different interval. If I create one timer per item, am I going to saturate the system with threads? I was thinking it might be better to create one timer equal to the smallest interval i...