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

boost::asio server multi-process

I would to make a simple multi process (not thread) server. I've seen the iterative example in which it handles one request at a time. Instead I need to handle more requests(more on less 10) at the same time. In the classic c and c++ examples, I've…
marco
  • 21
  • 3
2
votes
1 answer

Boost Asio, io_service handles only one socket per core

I am writing a server application using Boost Asio: Server: Running io_service.run() from pool of threads (one thread per core), accepting connections & reading data from sockets is done asynchronously. Client: Each client connects and sends a…
Aldin
  • 23
  • 3
2
votes
2 answers

Boost asio: Send OpenCV IplImage from Ubuntu-Server to Win7-Client

I try to transmit an OpenCV IplImage from a Server (Ubuntu x64) to a Client (Win7 x64) using the boost asio library. The following code works fine if both (Client and Server) are on the same operating system. But when the server is on Ubuntu and the…
Dave
  • 23
  • 2
  • 4
2
votes
1 answer

boost::asio::basic_waitable_timer `cancel` behavior

Assume there is asio's deadline_timer or similar, it expires and the callback is invoked. During the invocation and while the callback is still running the cancel is called. The question is the cancel gonna block until the callback finishes?
kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
2
votes
1 answer

Can I make a HTTPS request or HTTP/2 request using Boost.Asio and Boost.Beast libraries?

I am planning to build a small crawler in C++ for my projects. I chose the Boost.Asio library to achieve networking functionality. But then, I came across Boost.Beast library and I am confused as of which library to use. I have 2 doubts: Question 1:…
Panther Coder
  • 1,058
  • 1
  • 16
  • 43
2
votes
1 answer

Multiple connections on the same boost tcp socket object

In this example(async_tcp_echo_server.cpp), #include #include #include #include #include using boost::asio::ip::tcp; class session : public std::enable_shared_from_this { public: …
nishantsingh
  • 4,537
  • 5
  • 25
  • 51
2
votes
1 answer

Get UDP Socket Remote Address using boost::asio

I would like to get the IP address of the device that responds to UDP broadcast. In the following code I perform UDP broadcast to find a device. When the device response I try to get the remote endpoint using remote_endpoint(). However the…
yasuko
  • 35
  • 4
2
votes
1 answer

Multiple parallel calls to udp::socket::async_receive_from - undefined behaviour?

I am using boost::asio to create a server application, specifically the UDP APIs. Right now I start multiple threads from a pool listening to separate buffers using async_receive_from. This works great on Ubuntu where I develop mostly. However, when…
Max
  • 4,345
  • 8
  • 38
  • 64
2
votes
1 answer

How to implement async/await syntax properly using Boost.Asio

I'm trying to implement some network application using Boost.Asio. I have a problem with multiple layers of callbacks. In other languages that natively support async/await syntax, I can write my logic like this void do_send(args...) { if…
kebugcheck
  • 153
  • 2
  • 11
2
votes
1 answer

boost beast memory usage for bulk requests

I run this boost-beast-client-async-ssl example and it's OK. But, if I create 10000 sessions at same time, my program memory usage grows up to 400 MB and never down. I'd test without ssl (simple http), and there wasn't grows up memory. Q: What's…
2
votes
1 answer

Computers on LAN do not consistently receive a UDP broadcast to 255.255.255.255 using boost::asio C++

I am quite new to network programming, but nonetheless I am working on a personal project that requires interfacing between two computers on the LAN. For all of my networking needs, I am using boost. Since computers running my software on the LAN do…
Sock
  • 43
  • 4
2
votes
1 answer

Read child process stdout in a separate thread with BOOST process

I have a main program that uses boost process library to spawn a child process that prints Hello World ! on its stdout every 5 seconds. I would like to read/monitor the stdout of the child process in the main process when it becomes available…
sbunny
  • 433
  • 6
  • 25
2
votes
0 answers

Boost, send a binary_oarchive over TCP, sudden slowdown

I am using boost to serialize a struct, then sending that struct over tcp to another application. (both on the same machine, for testing purposes). This was all running well, and the total time to pack, send and unpack was around 10ms. Now,…
anti
  • 3,011
  • 7
  • 36
  • 86
2
votes
1 answer

How can we sequentially receive multiple data from boost::asio::tcp::ip::read_some calls?

Let us suppose that a client holds two different big objects (in terms of byte size) and serializes those followed by sending the serialized objects to a server over TCP/IP network connection using boost::asio. For client side implementation, I'm…
user9414424
  • 498
  • 3
  • 15
2
votes
1 answer

Using Boost asio to receive commands and execute them

I'm trying to make a boost server, which will receive commands and do certain things. Now I would like to create a function, that will receive a file and save it to a specific location. The problem is with serialization. I don't know how can I…
k-krakowski
  • 43
  • 1
  • 7