boost-asio

Asynchronous Mysql connector for C++ or C

Does there exist any asynchronous connectors to Mysql that can be used in C or C++? I'm looking for something that can be plugged into a reactor pattern written in Boost.Asio. [Edit:] Running a synchronous connector in threads is not an option. ...

How Does Listening to a Multicast Hurt Me?

I'm receiving a recovery feed from an exchange for recovering data missed from their primary feed. The exchange strongly recommends listening to the recovery feed only when data is needed, and leaving the multicast once I have recovered the data I need. My question is, if I am using asio, and not reading from the NIC when I don't need ...

Is it a problem if multiple different accepting sockets use the same OpenSSL context?

Is it OK if the same OpenSSL context is used by several different accepting sockets? In particular I'm using the same boost::asio::ssl::context with 2 different listening sockets. ...

Strange call stack, could it be problem in asio's usage of openssl?

I have this strange call stack and I am stumped to understand why. It seems to me that asio calls open ssl's read and then gets a negative return value (-37) . Asio seems to then try to use it inside the memcpy function. The function that causes this call stack is used hunderds of thousands of times without this error. It happens ...

Strange program hang, what does this mean in debug?

Strange program hang, what does this mean in debug? After attaching windbg I found the following: (1714.258): Access violation - code c0000005 (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=015b5c74 ebx=178a13e0 ecx=dddddddd edx=009a8ca0 esi=09fbf698 e...

Best documentation for Boost:asio ?

The documentation available on the boost website is... limited. From what I've been able to read, the general consensus is that it is simply difficult to find good documentation on the boost::asio library. Is this really the case? If so, why? Notes: I have already found the (non-boost) Asio website - and the documentation looks to ...

How to set a timeout on blocking sockets in boost asio?

Is there a way to cancel a pending operation (without disconnect) or set a timeout for the boost library functions? I.e. I want to set a timeout on blocking socket in boost asio? socket.read_some(boost::asio::buffer(pData, maxSize), error_); Example: I want to read some from the socket, but I want to throw an error if 10 seconds have ...

can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio?

can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio? If so how? Note I know you can use timers instead, but I'd like to know about these socket options in particular. ...

Is there a "nice" way to deal with reassembling multicasts from multiple sources?

Hi all I'm currently reworking our existing proprietary socket wrapper code to use boost asio so that it can do some of the heavy lifting for us. Perhaps the most complex area of our existing code is the multicast handling code. The code allows our middle-tier servers (of which there can me many in one system) to send multicasts to c...

How to detect deadlock whith Asio library?

Hi, i have little problem with boost::asio library. My app receive and process data asynchronously, it create threads and run io_service.run() on each of them. boost::asio::io_service io; boost::thread_group thread_pool; ... int cpu_cnt = get_cpu_count(); for (int i = 0; i < cpu_cnt; ++i) { thread_pool.create_thread( boost::bind(&ru...

Whats the deal with boost.asio and file i/o?

I've noticed that boost.asio has a lot of examples involving sockets, serial ports, and all sorts of non-file examples. Google hasn't really turned up a lot for me that mentions if asio is a good or valid approach for doing asynchronous file i/o. I've got gobs of data i'd like to write to disk asynchronously. This can be done with nativ...

What's the best way of ensuring valid object lifespan when using Boost.Asio?

Hi all. Been playing a lot with Boost.Asio of late. I like the library a lot since it offers a fantastic way to squeeze performance out of today's multicore systems. A question I have asked myself a few times, and I thought worth throwing out there regards object lifespan / ownership when making async calls with Asio. The problem I'v...

How do I perform a nonblocking read using asio?

I am attempting to use boost::asio to read and write from a device on a serial port. Both boost::asio:read() and boost::asio::serial_port::read_some() block when there is nothing to read. Instead I would like to detect this condition and write a command to the port to kick-start the device. How can I either detect that no data is availa...

boost asio and endian

I cant tell, does boost asio handle endian? ...

boost::asio::serial_port reading after reconnecting Device

I have a problem with the boost::asio::serial_port class reading from a GPS device (USB-Serial). Connecting the device and reading from it works fine, but when I disconnect and reconnect the device, read_some doesn't read any bytes from the port. As boost doesn't seam to detect that the serial port is gone ( is_open() returns true ), I ...

Can`t really understand what the parameters for constructing tcp::resolver::query

Hi everybody, I am starting Boost.Asio and trying to make examples given on official website work. here`s client code: using boost::asio::ip::tcp; int _tmain(int argc, _TCHAR* argv[]) { try { boost::asio::io_service io_service; tcp::resolver resolver(io_service); tcp::resolver::query query(argv[1], "daytime"); ...

How boost.asio discover which port is my server app listening on?

it is a little bit strange to me that boost.asio doesn`t use basic concept when client app connecting to the server - using IP address and port. May be I am a little bit noobie in Boost - and I accept that - but anyway I do not understand. So, I have code like this to get client connected to the server on the localhost: boost::...

How to get IP addresss of boost::asio::ip::tcp::socket?

Hello, I'm writing a server in C++ using Boost ASIO library. I'd like to get the string representation of client IP to be shown in my server's logs. Does anyone know how to do it? ...

Serialize and send a data structure using Boost?

I have a data structure that looks like this: typedef struct { unsigned short m_short1; unsigned short m_short2; unsigned char m_character; } MyDataType; I want to use boost::serialization to serialize this data structure, then use boost::asio to transmit it via TCP/IP, then have another application receive the data and de-seri...

boost::asio::ip::tcp::resolver::resolve() blocks forever...

I'm trying to create something similar as this code found at the boost.asio examples. socket.h: class some_class { private: ... boost::asio::io_service io_service; public: some_class() { /* This stuff isn't used in the example... ...but it doesn't change anything... */ io_ser...