Skip to main content

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.

0 votes
0 answers
13 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 ...
WPaul's user avatar
  • 1
3 votes
1 answer
74 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 ...
Dankmeister's user avatar
0 votes
0 answers
31 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 ...
IvanYanakiev's user avatar
0 votes
2 answers
83 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()....
Danek's user avatar
  • 11
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 --...
Rainb's user avatar
  • 2,303
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_{...
kmft3kte's user avatar
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 (...
Superlokkus's user avatar
  • 4,945
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 ...
Jon Lachmann's user avatar
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 ...
ThomasAlvaEdison's user avatar
0 votes
1 answer
52 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 ...
bustus_primus's user avatar
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 &...
John's user avatar
  • 3,348
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 ...
Reizo's user avatar
  • 1,462
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 ...
Reizo's user avatar
  • 1,462
1 vote
1 answer
66 views

What executor does co_await boost::asio::this_coro::executor produce?

The documentation of boost::asio::this_coro::executor states that it is an Awaitable object that returns the executor of the current coroutine. To me this seems somewhat vague as soon as multiple ...
Reizo's user avatar
  • 1,462
2 votes
1 answer
113 views

Boost Asio: Executors in C++20 coroutines

While experimenting with boost::asio::awaitable and Executors, I keep observing some rather confusing behaviour that I would like to understand better Preparation Please take a look at the follwing ...
Reizo's user avatar
  • 1,462

15 30 50 per page
1
2 3 4 5
316