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
1
vote
1 answer

Boost::asio: Port cancels itself second time it's read after cancel

I posted a very similar question before, but it hasn't been fully answered yet. (I'm trying to read a serial port repeatedly but I have to test what happens when the wire is disconnected. Apparently the first time it will time out as expected, but…
Typhaon
  • 828
  • 8
  • 27
1
vote
2 answers

How to use a single Boost::asio::io_context for multiple sockets and serial ports

I'm using Boost::Asio to create multiple UDP sockets and serial ports, and I use a single boost::asio::io_context that is shared among all of them (given in the constructor). All devices are configured to run with async reads and writes. Then, I…
Alexandre
  • 498
  • 2
  • 8
1
vote
1 answer

Why is boost::asio::io_context::run() still blocking after boost::beast::websocket::stream::close()?

I have a pool of threads using concurrently the same io_context to run a websocket stream. I am doing this because first, I have actually 2 websocket streams (I abstracted this because by testing it appears not to be the problem), and because I want…
kmft3kte
  • 23
  • 6
1
vote
1 answer

Segfault on async Boost Asio with use_future

I am using the asio library and I am trying to asynchronously connect to a socket with use_future. My code works 90% of the time but segfaults occasionally. Here is the code that I have. I narrowed it down to find that it prints checkpoints 2,3 but…
ILutRf7
  • 39
  • 2
1
vote
1 answer

boost asio: Is it thread safe to call tcp::socket::async_read_some() when handler is protected by a strand

I'm struggle to full understand Boost ASIO and strands. I was under the impression that the call to socket::async_read_some() was safe as long as the handler was wrapped in a strand. This appears not to be the case since the code eventually throws…
sullyt
  • 33
  • 4
1
vote
1 answer

Boost socket acceptor segmentation fault

Im trying write tcp server. From boost guide link enter link description here. When im trying open acceptor - segmentation fault, IDE show me this line object_pool_access::prev(live_list_) = o; What im doing wrong? Im trying another way for example…
lbsmart
  • 83
  • 6
1
vote
1 answer

Boost.asio OpenSSL HTTPS Proxy Request handshake failed C++

I am learning TCP Socket Windows programing with Boost/OpenSSL/VS2019. I guess the below code is a typical server example that echoes received data to the client, it worked as expected when tested with client program. But when tested with a browser…
1
vote
2 answers

What would cause a C++ .exe and .dll to only work on the machine it was built on?

I am using VS2010 and am working with this project. http://www.codeproject.com/KB/audio-video/Asio_Net.aspx Initially, I downloaded the demo binary and it would crash on my machine. After reading through some of the comments, it said to download the…
bulltorious
  • 7,769
  • 4
  • 49
  • 78
1
vote
1 answer

Do ASIOs io_context.run() lock the thread into busy waiting

I think a straightforward question that i cant seem to find any information on. When calling ASIOs io_context.run(), if there is at that moment nothing yet to read/write asynchronously, does asio do busy waiting with that thread or does it do…
pSquared
  • 65
  • 7
1
vote
0 answers

Find the best way to reconnect Boost::Beast websocket

I'd like get an advice about how to replace boost::beast based ssl websocket connection between 2 different servers that will minimize the reconnection time. my web socket client object is from the following type as a member variable of …
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
0 answers

What values of error_code can a boost timer callback receive?

Like many asio callbacks asio timer callbacks take argument const boost::system::error_code& I am curios if it is documented what are possible values for that argument, since from my naive understanding of reading header documentation only one…
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
1
vote
1 answer

Boost async_read_some data doesn't last long

I'm trying to write asynchronous write and read data. I have some function which causes write to buffer: /* struct DDSEntity { std::string key; std::string participant_key; std::string topic_name; std::string topic_type; bool…
1
vote
1 answer

Server written using asio (non boost) library gets the data only after a client disconnects

This is my server session code that should read the incoming client data asynchronously. I am using a free standing read function. When I tested this using Google Test(using local host, and both client and server on same computer), it worked fine. I…
cpp_hex
  • 603
  • 1
  • 5
  • 7
1
vote
1 answer

Different ways of opening and binding a UDP socket with Boost Asio c++

I'm trying to create a simple UDP broadcast class in c++ using the Boost Asio library. Specifically, in the main class I'd like to instantiate a socket to both send and receive data. But I've seen three different ways of doing so, and I wanted to…
Andrea
  • 429
  • 6
  • 14
1
vote
1 answer

Implementing task primitives based on asio::awaitable

I'm looking for a way to implement task primitives like whenAll, whenAny, taskFromResult on top of (boost) asios awaitable coroutine type. What I've got so far is a function that creates an awaitable from a completion callback. However I'm…