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.

Most programs interact with the outside world in some way, whether it be via a file, a network, a serial cable, or the console. Sometimes, as is the case with networking, individual I/O operations can take a long time to complete. This poses particular challenges to application development. The Boost.Asio library is intended for programmers using C++ for systems programming, where access to operating system functionality such as networking is often required.

More information on Boost.Asio can be found here:

Notable alternatives for Boost.Asio:

4582 questions
2
votes
0 answers

How to implement a connection pool with Boost asio?

I have thousands of concurrent client threads with C10K synchronized request, newing a tcp connect when request comes might be time-consuming, and it cannot be scalable if the number of concurrent threads goes up. So I thought a shared…
joe
  • 177
  • 1
  • 1
  • 11
2
votes
1 answer

Boost.Asio: The I/O operation has been aborted because of either a thread exit or an application request

I am learning Boost.Asio. I created a simple program to resolve a host name to IP address. It works fine when using the synchronous resolve operation. However, when I try the asynchronous way, there is some strange behavior. #include…
kebugcheck
  • 153
  • 2
  • 11
2
votes
2 answers

Using multiple async_wait in a multithreaded program

I have the following program, taken from http://www.boost.org/doc/libs/1_65_1/doc/html/boost_asio/tutorial/tuttimer5.html #include #include #include #include #include…
Pierre P.
  • 1,055
  • 2
  • 14
  • 26
2
votes
0 answers

io_service.run() and io_service.poll() in a main function

Currently looking at a more detailed tutorial (https://www.gamedev.net/blogs/entry/2249317-a-guide-to-getting-started-with-boostasio/) than the ones provided on the Boost.Asio website but there are still some things I don't understand. Given this…
Pierre P.
  • 1,055
  • 2
  • 14
  • 26
2
votes
1 answer

What's the lifetime of boost::asio::ip::tcp::resolver::iterator from async_resolve?

When I call boost::asio::ip::tcp::resolver::async_resolve, my handler receives an ip::tcp::resolver::iterator that iterates through one or more ip::tcp::resolver::entries. What is their lifetime, and what is the handle that keeps them alive? For…
Dave M.
  • 1,496
  • 1
  • 12
  • 30
2
votes
2 answers

Boost asio, single TCP server, many clients

I am creating a TCP server that will use boost asio which will accept connections from many clients, receive data, and send confirmations. The thing is that I want to be able to accept all the clients but I want to work only with one at a time. I…
2586steps
  • 39
  • 1
  • 4
2
votes
1 answer

Boost Asio udp resolver returning faulty endpoint iterator

Upon starting my program I need to retrieve the local (LAN) address of the machine running it. The way I do this is the following: try { asio::io_service ioService; asio::udp::resolver resolver(ioService); asio::udp::query…
Aymar Fisherman
  • 388
  • 1
  • 8
2
votes
1 answer

Boost asio async_read_until stop reading on matched condition

I have a general question about using boost asio's async_read_until. The documentation says there might be more data inside the buffer when the handler is called. Is there any way to work around this and stop the buffer from consuming bytes from the…
Gustavo
  • 919
  • 11
  • 34
2
votes
1 answer

Boost echo server example and capturing this and shared_from_this() in lambda

In boost async-tcp-echo-server example there is a server class which creates a session on a new connection: acceptor.async_accept(socket, [this](boost::system::error_code ec) { if (!ec) …
K. Koovalsky
  • 596
  • 4
  • 17
2
votes
1 answer

boost::asio::io_service throws exception

Okay, I seriously cannot figure this out. I have a DLL project in MSVC that is attempting to use Asio (from Boost 1.45.0), but whenever I create my io_service, an exception is thrown. Here is what I am doing for testing purposes: void run() { …
DSB
  • 417
  • 1
  • 4
  • 8
2
votes
1 answer

boost::asio server with simple functions

Guys I really need your help. I'm learning boost::asio and I have 2 problems that I can't deal for days... Here is an example of a simple echo server done by myself: int main( { // crate a server, binding it and listening connections //…
2
votes
1 answer

How to write data to a MutableBufferSequence

I'm trying to implement an AsyncReadStream stream to read from std::cin and so far have the following code: template void async_read_some(const MutableBufferSequence &buf, ReadHandler handler) { …
Jibbity jobby
  • 1,255
  • 2
  • 12
  • 26
2
votes
0 answers

Boost ASIO SSL server, use different certificate depending on SNI

I'm currently writing a small HTTP server, and I would like to implement SSL. The goal is to be able to do load multiple PEM files in boost so it can do a correct SSL handshake with a client depending on the SNI sent in TLS. However I don't see how…
Ben D
  • 465
  • 1
  • 6
  • 20
2
votes
1 answer

Python socket not receiving all data from C++ Boost asio

In a nutshell I am trying to send encoded and compressed image data (~300kB) from a boost::asio server (embedded system) and receive it via python socket client (laptop). The client seems to be receiving only 65532 bytes every time while the client…
krismath
  • 1,879
  • 2
  • 23
  • 41
2
votes
1 answer

Clearing boost::array

I'm using a boost array as buffer for the content I get from the async_read of the boost::asio. After reading I want to clear/reset the buffer for the next read. Please tell me how can i do this.
Manoj
  • 5,542
  • 9
  • 54
  • 80
1 2 3
99
100