Questions tagged [asio]

ASIO stands for Audio Stream Input/Output, a digital audio protocol. For questions about the Boost.Asio C++ library for asynchronous I/O, use the [boost-asio] tag to avoid ambiguity.

Audio Stream Input/Output is a low-latency protocol for sending and receiving audio data from sound interfaces. It was developed by Steinberg, which offers a licensed ASIO SDK among other audio software technology such as VST plugins.


Please note that in order to avoid ambiguity, questions about Boost.Asio should be tagged with as discussed on meta.

479 questions
2
votes
1 answer

How can I transfer one string between two or more computers over network in cmd c++ boost::asio?

the question is, how can I connect one program between two or more computers over a network, in other words, I want to create a dialog application on Windows in cmd (yes, the idea can be strange and stupid, but it just arouses incredible interest in…
2
votes
1 answer

Interrupt all threads in the Boost Asio Thread Pool

I commonly use boost::thread to run threads. I need threads to be interrupted easely, so I use boost::this_thread::interruption_point(). The code looks like this: void do_long_calculations() { for (...) { …
Raider
  • 197
  • 2
  • 10
2
votes
1 answer

How to use an executor from a boost::asio object to dispatch stuff into the same execution thread?

Ok, I don't have enough code yet for a fully working program, but I'm already running into issues with "executors". EDIT: this is Boost 1.74 -- Debian doesn't give me anything more current. Which causes problems elsewhere, but I hope it had working…
Christian Stieber
  • 9,954
  • 24
  • 23
2
votes
1 answer

Asio difference between work(), require() and make_work_guard()

Sorry to interrupt, I am a newbie in C++ and Asio... I just come from here Asio difference between prefer, require and make_work_guard. I am trying to make a "dummy work" for my io_context. It is really confusing to a beginner who just wants to make…
2
votes
1 answer

Why we can reuse a moved socket_ in acceptor_.async_accept?

Reference: https://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_socket_acceptor/async_accept/overload1.html boost::asio::ip::tcp::acceptor acceptor(io_service); ... boost::asio::ip::tcp::socket socket(io_service); // you have…
q0987
  • 34,938
  • 69
  • 242
  • 387
2
votes
1 answer

boost asio broadcast not going out on all interfaces

If set up a program with boost asio. Broadcasts are working fine, if only one network interface is present. However, if there are more network interfaces each broadcast is being sent on one interface only. The interface changes randomly. As observed…
Bil_Bomba
  • 183
  • 1
  • 8
2
votes
2 answers

Boost.Asio async_read a string from a socket

I'm trying to write a function async_read_string_n to asynchronously read a string of exactly n bytes from a socket with Boost.Asio 1.78 (and GCC 11.2). This is how I want to use the function async_read_string_n: void run() { co_spawn…
James Brock
  • 3,236
  • 1
  • 28
  • 33
2
votes
1 answer

asio custom async function and c++20 coroutines

I'm migrating my asio application from its stackful coroutines to c++20 stackless coroutines. I have an existing class method that looks like this: int my_async_op(asio::yield_context yield) { using tResult =…
user1715587
  • 155
  • 1
  • 10
2
votes
1 answer

How to connect with boost::asio to a HTTPS server using a proxy?

In our application we use boost::asio to connect using HTTP and HTTPS. We also can use a HTTP proxy. Now i need to add support for a HTTPS server using a proxy. I studied quite a few samples and find that the needed steps seem to be: Create a HTTP…
RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92
2
votes
1 answer

Reading a buffer from a json using boost

I have the following json…
Flav Scheidt
  • 105
  • 5
2
votes
1 answer

asio underlying behavior in async_receive

I have worked with asio library for a few projects and have always managed to get it work, but I feel there are somethings of it that I have not entirely/clearly understood so far. I am wondering how async_receive works. I googled around a bit and…
Keivan
  • 673
  • 7
  • 15
2
votes
1 answer

Best practise for boost::asio timeouts when using coroutines

The connection attempt below creates (on my network configuration) a delay of 2 minutes because the target does not exist and the address is on a different subnet to my machine. So I added timeout logic to limit the attempt to 5 seconds: #define…
cmannett85
  • 21,725
  • 8
  • 76
  • 119
2
votes
1 answer

Boost Asio: Strange when use streambuf and async_write in mutl-thread

My program has a buffer when sending data. Instead of directly calling async_write every time for send small packets, try to make the send method return quickly, use streambuf as the sending buffer, and try to send large packets. The problem…
junya
  • 21
  • 2
2
votes
1 answer

Synchronization and result retrieval with ASIO coroutines and networking TS with C++20

I am experimenting with asio stackless coroutines and newly introduced C++20 constructs for co_return, co_await. I went through the examples and have a few questions based on my understanding and because I still see race condition related crashes…
divot53305
  • 61
  • 3
2
votes
2 answers

How to eliminate crashes when destroying boost::asio entities on fly?

Note!!! The question is for people who are experts in boost::asio library. Unfortunately, I cannot do the code more compact, It contains a minimum amount to describe the problem. The code is example, artificially created. Places where it crashes…
brandy
  • 31
  • 5