Questions tagged [boost-asio]

Boost.Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.

Most programs interact with the outside world in some way, whether it be via a file, a network, a serial cable, or the console. Sometimes, as is the case with networking, individual I/O operations can take a long time to complete. This poses particular challenges to application development. The Boost.Asio library is intended for programmers using C++ for systems programming, where access to operating system functionality such as networking is often required.

More information on Boost.Asio can be found here:

Notable alternatives for Boost.Asio:

4582 questions
2
votes
1 answer

boost::asio error "The I/O operation has been aborted..."

I am receiving this error message "The I/O operation has been aborted because of either a thread exit or an application request" when using boost::asio::socket::async_read_some() What does the error mean? What should I be looking for? Here is the…
ravenspoint
  • 19,093
  • 6
  • 57
  • 103
2
votes
1 answer

ASIO UDP: class std::allocator has no member named ‘construct’

I have followed this example to set up an asynchronous UDP receive. But it fails on compilation: g++ -Wall -Wconversion -Wfatal-errors -Wextra -std=c++11 test1.cpp Error message: In file included from /usr/include/c++/5/ext/alloc_traits.h:36:0, …
ar2015
  • 5,558
  • 8
  • 53
  • 110
2
votes
1 answer

How asio deal with SIGPIPE?

Asio has code to ignore SIGPIPE which is in Signal_init.hpp, however there is a macro warp it in io_service.hpp: #elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \ || defined(__osf__) I compile in Ubuntu found the…
jean
  • 2,825
  • 2
  • 35
  • 72
2
votes
1 answer

Replacing select() with boost::asio::io_service

I am trying to replace the main loop in my program ( while(1)...select() ) with boost::asio::io_service.run(). The program has a couple sockets open, which were monitored by select(). The tricky part is that the FD_SET in the select statement has…
Rusty
  • 1,095
  • 9
  • 15
2
votes
2 answers

Boost asio serial port "end of file"

I am trying to read serial data coming from arduino, but when I run my program it only reads all the data in the buffer, the data that was actually send before the program started. And then i terminates with the following error: terminate called…
2
votes
1 answer

How to fix Undefined symbols for architecture x86_64, Boost Asio 1.58

I am working on a little software that needed a small server that listens to http requests. Unfortunately, the productive server uses https only, so the requests fail. I've search the web and found this example:…
user5444681
2
votes
1 answer

Segmentation Fault running boost example

I am trying to run the autoecho program that uses boost::asio and boost::fiber. I am using the following: Ubuntu 16 cmake 3.9.1 boost 1_65_0 That program depends on a local copy of round_robin.hpp, yield.hpp and detail/yield.hpp. I have downloaded…
Mark
  • 2,058
  • 2
  • 35
  • 64
2
votes
2 answers

Boost asio handler that does not keep the io_service running

I want to add a signal handler to my boost io_service, allowing the application to shut down cleanly when the user presses Ctrl-C. This is of course easily done by stopping the loop, something like this: boost::asio::io_service…
Martijn Otto
  • 878
  • 4
  • 21
2
votes
1 answer

Boost ASIO blocking callbacks

Is it safe (or reasonable) for a the callback from asio to block? void Connection::start() { /* Assume std::string buffer; that has data to write. */ auto callbackFn = boost::bind(&Connection::callback, shared_from_this(), …
Braaedy
  • 540
  • 1
  • 5
  • 16
2
votes
1 answer

websocketpp asio listen error

I have a multi-threaded websocketpp server. With no clients connected when I quit the program and relaunch, it works with no issues. However when a client is connected and I quit/relaunch, the program throws this error [2017-08-06 15:36:05] [info]…
coolarm
  • 119
  • 4
  • 14
2
votes
1 answer

boost::asio::buffer how to iterate over the bytes

I am trying to implement a function that takes a boost::const_buffer and iterates over its bytes in a loop. I saw that there is a buffers iterator, but it seems to be applicable for boost::asio::buffers_type. I didn't find any examples for simple…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
2
votes
1 answer

With boost::asio, do I need to notify_fork to do a simple fork/exec

It's unclear to me whether I need to use notify_fork when all I'm going to do is do a simple fork/exec to launch another program. My guess is that the intended use of notify_fork is to deal with a situation of fork only, as in the case of "process…
Tom Quarendon
  • 5,625
  • 5
  • 23
  • 30
2
votes
1 answer

"Wrong Version Number" error using Boost ASIO & SSL (C++)

I'm trying to connect to a server (written in Golang) using Boost Asio. I can connect and read/write fine unencrypted, but I can't seem to get SSL support to work. Basically, whenever I attempt a handshake I receive a "wrong version number". Here's…
GrandmasterB
  • 3,396
  • 1
  • 23
  • 22
2
votes
1 answer

Boost ASIO server - detecting idle connection

The intention of this post is to figure out how to implement a Keep-Alive timeout on a Boost ASIO based HTTP server. There are 2 parts to this - When the client has closed the connection When the client connection is inactive I believe, 1) above…
user1474341
  • 125
  • 1
  • 12
2
votes
0 answers

testing using google test multithreading

I need to tests multithreading code using google tests. Is any method to stop/block google test thread execution (I mean in the same test) until an event is happening? And after that event happens to go further with the test execution. Thank you
AlexM
  • 111
  • 4
1 2 3
99
100