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.
boost-asio
4,729
questions
0
votes
1
answer
31
views
Boost no matching member function for call to 'async_wait'
I am learning boost and trying to run example code: https://www.boost.org/doc/libs/master/doc/html/boost_asio/tutorial/tuttimer3/src.html
Boost version is 1.83.0
I have an error:
main.cpp:14:8: error: ...
0
votes
1
answer
67
views
Unexpected 'pointer is null' warning in boost asio library?
I'm compiling a project that incorporates the asio C++ library, and I'm getting a pesky warning:
../opendnp3/_deps/asio-src/asio/include/asio/impl/connect.hpp:75:73:
warning: ‘this’ pointer is null [-...
0
votes
0
answers
23
views
Boost.Asio IP Header how to set and read DSCP or TOS field
My application (coded in C++, using Boost.Asio lib, running on a LINUX machine) handles several UDP Multicast / IP sockets.
(#1) For the outbound traffic, I need to set the DSCP field of the IP Header ...
3
votes
1
answer
78
views
When constructing a new std::thread, is there a point to wrapping the callable in std::bind?
I'm pretty unfamiliar with modern C++, but I've been looking at the Boost.Beast sample files and trying to understand how they work.
Specifically, I've been looking at this http server sample.
Here's ...
0
votes
0
answers
32
views
Boost.Asio how does io_context poll work and how to poll in a tight loop?
I have been playing around with Boost.Asio and I want to be able to busy poll rather than simply perform an io_context.run(). My application currently consists of 2 io_context object each running on a ...
0
votes
2
answers
86
views
socket read access violation
During the second read from the socket I get a read error.
void ClientWindow::on_button_send_clicked()
{
auto message = std::make_shared<std::string>(ui->plainTextEdit->toPlainText()....
0
votes
1
answer
22
views
configure: error: Could not find a version of the Boost::Asio library
I am trying to compile https://github.com/lowRISC/riscv-isa-sim.git in msys2, but I cant get it to work, despite having boost and asio packages installed.
I get
/riscv-isa-sim-cosim$ ./configure --...
0
votes
0
answers
36
views
asio::stream_descriptor for async read from stdin in raw mode crashes
I want to poll stdin asynchronously for terminal keyboard events, hence the following
/* class tui contains a member 'stdin_' of type 'asio::stream_descriptor',
initialized as such : stdin_{...
3
votes
2
answers
103
views
Is the lifetime of a local lambda as a completion handler for co_spawn i.e. a function with functor&& sufficent
Question
I am getting a little confused or paranoid, given the pattern:
void setup(boost::asio::io_context &context) {
const auto completion_handler = [](std::exception_ptr ptr) {
if (...
0
votes
1
answer
31
views
Boost asio, timer inside async_receive_from wont trigger
I am trying to write a small UDP proxy using Boost asio. Within it I need to read a socket, and if that socket receives a datagram, a callback should be triggered after a specific time, forwarding the ...
0
votes
0
answers
19
views
Boost.Beast: websocket server which sends messages to all connected clients independently (no echo, maybe broadcast)
currently I am writing a C++ Application for simulating some flying objects in the real world (like GIS).
All the visualization stuff should be made in one or more browser (1 server, X clients).
To ...
0
votes
1
answer
53
views
prevent initial suspend of boost awaitable
I have a function that returns a boost::asio::awaitable that takes a large message object as argument to write a serialized string to a socket. Recently I was reading that a coroutine function will ...
2
votes
2
answers
80
views
Strange behavior when passing a cable captures `std::initializer_list<std::shared_ptr<Conversation>>` to the complete handler
The code snippet below always close the connection at once when a client has connected to the server, which is really out of my expection.
#include <iostream>
#include <memory>
#include &...
2
votes
1
answer
82
views
Boost Asio: What's the difference between the Executor passed to boost::asio::post and the associated executor of the CompletionToken?
For methods like post, and dispatch there is one overload taking only a CompletionToken and another additionally taking an Executor. As far as I know, the overload without Executor works as if the ...
1
vote
1
answer
47
views
Boost Asio: How to run a single handler in multiple independent strands?
Imagine in a multithreaded context we have three or more independent strands each serializing access to a different resource:
boost::asio::io_context ioc;
auto io_ex = ioc.get_executor();
auto ...