Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
88 views

Suppose we are waiting for incoming data on a socket using the call socket::async_wait(socket::wait_read, callback). After the callback notifies us that data is available, is it possible to read the ...
Joe J's user avatar
  • 1,391
2 votes
1 answer
143 views

As is well known, in Boost we can use a rate limit to restrict the read and write speed of a TCP stream, as indicated in the documentation: https://www.boost.org/doc/libs/latest/libs/beast/doc/html/...
Joe J's user avatar
  • 1,391
1 vote
1 answer
134 views

I have the following code using the C++ ASIO library that's intended to ensure messages are not interleaved on the socket being written to (as discussed here): #include <boost/asio.hpp> #include ...
jezza's user avatar
  • 482
0 votes
1 answer
169 views

I have a class like this: class Socket { public: boost::asio::awaitable<void> asyncConnect( boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>::value_type ...
Dmitriano's user avatar
  • 2,548
2 votes
1 answer
48 views

I built BOOST 1.89 on Ubuntu 24.04 with GCC 13.3.0 using the following commands: ./bootstrap.sh --prefix="/home/dmitriano/dev/libs/boost" ./b2 -j8 cxxstd=20 install See config and build log....
Dmitriano's user avatar
  • 2,548
1 vote
0 answers
122 views

According to the boost::asio documentation, for each io_context one or more additional threads can be created that will be used for host resolution. One or more additional threads per io_context to ...
Joe J's user avatar
  • 1,391
1 vote
1 answer
49 views

Is it guaranteed that token will be called on executor ex in the code below? template <class T, class CompletionToken> auto async_from_awaitable(asio::any_io_executor ex, asio::awaitable<...
Dmitriano's user avatar
  • 2,548
1 vote
1 answer
115 views

I want to set up a watchdog that checks whether the io_context workers can pick up tasks within a reasonable time and are not stuck running long or blocking operations. To achieve this, I've ...
Zohar81's user avatar
  • 5,214
2 votes
1 answer
102 views

I have a Websocket class that connects asynchronously using Boost.Asio and Boost.Beast. The following code was working fine with Boost 1.78, but after updating to the latest Boost version, I now get a ...
Rutvik Parekh's user avatar
4 votes
1 answer
143 views

I have the following program that just runs a timer for 5 seconds and has a signal handler. #include <boost/asio.hpp> #include <chrono> #include <iostream> #include <signal.h> ...
Pavel Krasnopevtsev's user avatar
2 votes
1 answer
91 views

I have a Windows application that uses boost.asio for I/O. but the asio's io_context::run() executes in a separate thread, because of WinMain() function has while() {} loop with PeekMessage() and ...
niXman's user avatar
  • 91
2 votes
1 answer
117 views

Assume I run multiple transfer tasks. How do I wait one task to finish and do not cancel others in bidirectional_transfer method? (Assume there are not two tasks, but three or more). #include <...
Dmitriano's user avatar
  • 2,548
1 vote
1 answer
83 views

I wrote an experimental TCP proxy with boost::asio and tried to replace all asio::use_awaitable with asio::experimental::use_promise in my code (as another experiment), and the following code stopped ...
Dmitriano's user avatar
  • 2,548
2 votes
2 answers
97 views

I am working in a system which uses a global Clock singleton to store the current time. class Clock { public: static Clock& instance() { static Clock clock; return clock; ...
Steve Lorimer's user avatar
3 votes
1 answer
87 views

How do I implement asyncConnectAndHandshake function that connects to a TCP server and than does SSL handshake and returns boost::asio::experimental::promise? #pragma once #include <boost/asio.hpp&...
Dmitriano's user avatar
  • 2,548
2 votes
1 answer
116 views

While investigating boost::asio::experimental::promise I wrote the code below with two asyncRead functions: #pragma once #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include &...
Dmitriano's user avatar
  • 2,548
4 votes
1 answer
110 views

SocketWrapper class has asyncRead that reads either from boost::asio::ssl::stream<boost::asio::ip::tcp::socket> or from boost::asio::ip::tcp::socket depending on isSSL() flag: #pragma once #...
Dmitriano's user avatar
  • 2,548
8 votes
1 answer
164 views

In Linux OS's multithread process, the signal isn't guaranteed to deliver to specific thread. And I wonder, when I use asio::signal_set::async_wait. Is this asynchronous operation guaranteed to ...
Searcher's user avatar
  • 147
2 votes
1 answer
125 views

Suppose I accept a socket by calling async_accept like this acceptor.async_accept([](const boost::system::error_code& ec, boost::asio::ip::tcp::socket sock) { if (ec) return; auto sess = std:...
Joe J's user avatar
  • 1,391
0 votes
0 answers
47 views

I checked out nghttp2/asio in my C++ project. I have built boost version 1.89.0 from source using b2. I am met with error "Could not find version of library" and as per the configure shell ...
Supreet Singh's user avatar
3 votes
1 answer
91 views

I wrote a simple program to learn how Asio works. Here's the code: #include <boost/asio.hpp> #include <iostream> namespace asio = boost::asio; using asio::ip::tcp; int main() { using ...
Searcher's user avatar
  • 147
2 votes
2 answers
119 views

This question nerd-sniped me by a problem mentioned in the comments: @sehe use_promise seems very interesting. I looked up some documentation about it and found some of your posts, like this. But how ...
sehe's user avatar
  • 401k
0 votes
0 answers
231 views

I'm trying to use asio::co_spawn with boost::future in Thread library, such that I could chain the co_routine task with then() function. But the problem is asio::use_future only generates std::future. ...
YzEdwin's user avatar
  • 21
0 votes
0 answers
106 views

I encountered a compiler bug when using C++20 + Boost.ASIO in Windows boost1.89 & msvc17.6: asio\co_composed.hpp(162,33): error C3546: '...': there are no parameter packs available to expand asio\...
travaller2's user avatar
2 votes
1 answer
197 views

I am reading a http::request<http::string_body> request from the network using boost::beast, which is of type multipart/form-data. The request contains files and strings. How can I get each part ...
Joe J's user avatar
  • 1,391
1 vote
1 answer
51 views

I would like to skip the whole boost library details when stepping through the code in the debugger. Example uninteresting things I would like to skip: (lldb) n Process 577286 stopped * thread #1, ...
Karoly Horvath's user avatar
5 votes
2 answers
132 views

I need to copy one boost::asio::streambuf to another. For this I decided to use std::ostream. At the moment I copy the buffer like this boost::asio::streambuf src; boost::asio::streambuf dst; std::...
Joe J's user avatar
  • 1,391
3 votes
1 answer
104 views

I create http::response<string_body> and call prepare_payload() after the response is built like this http::response<http::string_body> res; res.version(11); res.result(http::status::ok); ...
Joe J's user avatar
  • 1,391
3 votes
1 answer
153 views

I have two threads and I need to run a task from the first thread but in such a way that the task is executed in the second thread. For this I decided to use boost::asio::post, but I'm not sure if it ...
Joe J's user avatar
  • 1,391
2 votes
1 answer
192 views

The following code simulates short bursts of work by sleeping 1ms at a time in order to achieve a cancellable task that takes a total of 2s. That work is then launched in three different ways. The ...
Dalzhim's user avatar
  • 2,098
3 votes
1 answer
99 views

I have a websocket server where I call websocket::stream::async_accept to perform a handshake with the client. I also set a decorator to modify the headers like this conn->get_websocket_stream()....
Joe J's user avatar
  • 1,391
2 votes
2 answers
159 views

I'm trying to understand the memory order related to asio initiating functions and completion handlers, but I can't find any documentation on this. Asio examples tend to start the io_context::run ...
knatten's user avatar
  • 5,249
-1 votes
1 answer
145 views

I read TLS ClientHello data from the network using boost::asio like this socket->async_wait(ip::tcp::socket::wait_read, [=](const boost::system::error_code& ec) { std::size_t avail = socket-...
Joe J's user avatar
  • 1,391
4 votes
1 answer
65 views

I create http::response_parser<http::buffer_body> and set header_limit and body_limit like this auto parser = std::make_shared<http::response_parser<http::buffer_body>>(); parser->...
Joe J's user avatar
  • 1,391
1 vote
1 answer
152 views

How to verify if Boost.Asio actually uses Windows Overlapped I/O for file operations? I'm implementing high-performance file I/O in C++ on Windows and need to confirm whether Boost.Asio truly ...
Xiros's user avatar
  • 11
3 votes
1 answer
161 views

I have some code that creates an ssl::stream. The ssl::stream object takes an ssl::context in its constructor by reference. Creating an ssl::stream looks like this ssl::context ssl_context(boost::asio:...
Joe J's user avatar
  • 1,391
1 vote
1 answer
130 views

I want to close the TLS connection gracefully. So before closing the socket I call ssl::stream::shutdown. I call ssl::stream::shutdown in the session destructor and at that moment I have no active ...
Joe J's user avatar
  • 1,391
3 votes
1 answer
152 views

Suppose we have ip::tcp::socket and asynchronous operations, and at some point we call ip::tcp::socket::cancel. Is it guaranteed that all asynchronous operations will be cancelled? The documentation ...
Joe J's user avatar
  • 1,391
5 votes
1 answer
111 views

I'm encountering a strange issue using Boost.Asio coroutines in combination with steady_timer and experimental::concurrent_channel. Some coroutines never return from timer->async_wait. Here's a ...
Pqqwetiqe's user avatar
  • 374
1 vote
1 answer
71 views

I'm trying to bind a WebSocket connection to a specific network interface using Boost.Beast, but the socket keeps using the default interface instead of the specified one. I have a WebSocket client ...
nobody's user avatar
  • 13
2 votes
1 answer
110 views

I have one active async operation, it is http::async_read. At the moment when I want to close the ssl connection, I cancel this async operation on the socket by calling ip::tcp::socket::cancel. Then I ...
Joe J's user avatar
  • 1,391
2 votes
1 answer
154 views

I want to implement my own async initiating function and use the type erasure wrapper boost::asio::any_completion_handler. Assuming I want to store the completion handler for later, how do I ensure ...
Stefan Eiband's user avatar
3 votes
1 answer
152 views

Is it correct to call ssl::stream::async_shutdown while there are outstanding async_read_some/async_write operations? Should I wait for all async operations to complete before calling ssl::stream::...
Joe J's user avatar
  • 1,391
5 votes
1 answer
132 views

I would like to define a test case using experimental Resumable C++20 Coroutines from boost.asio, such that the coroutine would be implemented as a generator receiving a string under co_yield and ...
Sean Champ's user avatar
2 votes
1 answer
116 views

When I was trying to develop some example code for a question about completion tokens under co_await with boost asio's async_read_some for an asio::readable_pipe, I arrived at the following code, with ...
Sean Champ's user avatar
1 vote
1 answer
237 views

I'm trying to implement HTTP 1.1 pipelining using Boost Asio, Boost Beast and coroutines. What I've come up with for now is using one coroutine for receiving requests, one for sending responses and ...
climb4's user avatar
  • 326
2 votes
1 answer
95 views

I'm using the BOOST_ASIO_ENABLE_HANDLER_TRACKING flag in Boost.Asio to enable handler tracking logs, which provides useful debugging output to the standard error stream. I have a couple of questions ...
Zohar81's user avatar
  • 5,214
0 votes
0 answers
99 views

I'm encountering an issue with the Boost.Asio library. My program uses a single io_context instance and multiple worker threads that call io_context::run(). Tasks are posted using spawn or post on the ...
Zohar81's user avatar
  • 5,214
1 vote
1 answer
130 views

Code firstly, very simple example code: template <typename CompletionToken> decltype(auto) test_initiate(CompletionToken&& token) { return boost::asio::async_initiate<...
Simon. Li's user avatar
  • 441
3 votes
1 answer
62 views

I have a response parser of type http::response_parser<http::buffer_body>, which I need to convert to a parser of type http::response_parser<http::string_body>. I do the conversion after ...
Joe J's user avatar
  • 1,391

1
2 3 4 5
98