516 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
1
answer
69
views
What's going on with asio::async_compose?
The following code snippet produces a compilation error:
error: deduced type 'void' for 'err' is incomplete.
What I don't understand is this. Shouldn't err be of type error_code?
#include <boost/...
2
votes
1
answer
107
views
asio: asio::awaitable<void> yield execution to other ready tasks
Consider the code
#include <asio.hpp>
asio::awaitable<void> doit(char ch)
{
for (int i = 0; i < 5; ++i) {
fprintf(stderr, "%c %d\n", ch, i);
asio::...
1
vote
1
answer
147
views
Race condition with ordered send queue in ASIO
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 ...
8
votes
1
answer
171
views
Asio's signal handling under multithreaded scenarios
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 ...
0
votes
0
answers
239
views
How to use boost::asio::co_spawn with boost::thread::future?
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. ...
0
votes
1
answer
118
views
How to make recordings using C#.NET, NAudio, ASIO4ALL, WinUI 3 (part of Windows App SDK), and Visual Studio 2022
The goal is to use NAudio, ASIO4ALL, WinUI 3 (a part of the Windows App SDK), and C#.NET in Visual Studio 2022 to make recordings. Unfortunately, such goal hasn't been reached as of yet.
I based my ...
3
votes
1
answer
157
views
How to gracefully shutdown asio::ssl::stream<asio::ip::tcp::socket> in C++ Asio? (shutdown always throws "stream truncated" exception)
I'm building a client-server project using standalone Asio (C++20) and OpenSSL. My client uses asio::ssl::stream<asio::ip::tcp::socket> for TLS connections.
After my client is done communicating ...
user avatar
user30603536
-1
votes
1
answer
154
views
How to deal with OpenSSL poluting the global namespace in C++?
I am trying to build C++ code with ASIO and OpenSSL (on windows, without boost). I have been using ASIO no problem for a while now. However, I now tried to include "asio/ssl.hpp" and I get a ...
3
votes
1
answer
76
views
AsyncOperation Reading and Writing
There is a test code for main, It's pretty simple.
void AddData(std::shared_ptr<std::queue<std::string>> stores)
{
stores->push("A\n");
stores->push("B\n")...
2
votes
1
answer
222
views
Boost asio serial port premature completion on async_read
I have a class that wraps a boost::asio::serial_port on a Windows system. I use it to start asynchronous reads on a supplied buffer.
It works well in most cases when there is data in the queue before ...
SupAl's user avatar
- 1,131
3
votes
0
answers
182
views
Is there a way to drain websocket in boost asio?
I am using asio/beast for tcp ssl connections. Calling async_read in a loop inside corouties.
In situations when I have N packets on websocket I need to do N async_reads to drain the websocket. This ...
0
votes
0
answers
53
views
is executor of asio always smart-ptr like?
When using asynchronous programming, the life cycle is always particularly complex. In order to control the life cycle effectively, I always try to use smart pointers to encapsulate all the objects ...
vipcxj's user avatar
- 1,108
2
votes
1
answer
326
views
why boost asio tcp resolver creates threads for async resolve
When I use the following code, it spawns a new thread.
resolver_.async_resolve(
host_, port_,
beast::bind_front_handler(&session::on_resolve, shared_from_this()));
But when I change ...
3
votes
1
answer
58
views
boost asio single threaded post() doesn't post when poll() is used?
Everything is handle in a single thread
void GameClient::test()
{
std::cout <<"called test" << std::endl;
m_io_context.post([](){
std::cout << "test&...
2
votes
1
answer
162
views
Boost asio using concrete executor type with c++20 coroutines causes compilation errors
I am implementing a very simple UDP client using the Boost ASIO library with C++20 coroutines.
To try to gain a little performance cheaply, I am trying to use a concrete executor type asio::io_service:...