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

Use streambuf as buffer for boost asio read and write

I'm using this code for reading socket_.async_read_some(boost::asio::buffer(data_, max_length), boost::bind(&session::handle_read, this, boost::asio::placeholders::error, …
user1307957
  • 541
  • 3
  • 8
  • 19
14
votes
3 answers

How to correctly send binary data over HTTPS POST?

I send binary data from client (Debian 6.0.3) to server (Windows Server 2003). To bypass most firewalls I use HTTPS POST. Client and server are implemented using Boost.Asio and OpenSSL. First I implemented the simplest possible version and it worked…
Andriy Tylychko
  • 15,967
  • 6
  • 64
  • 112
14
votes
1 answer

HTTPS request with Boost.Asio and OpenSSL

I'm trying to read the ticker symbol at https://mtgox.com/api/0/data/ticker.php from my C++ application. I use Boost.Asio and OpenSSL because the service requires HTTPS. Boost version: 1.47.0 OpenSSL: 1.0.0d [8 Feb 2011] Win32 For the application;…
Maarten
  • 1,037
  • 1
  • 11
  • 32
14
votes
1 answer

io_service::poll_one non-deterministic behaviour

In the following code, I expect the output to always be 1, because I am expecting only one handler to run when poll_one() is called. However, once in about 300 times, the output is actually 3. Based on my understanding of the boost library, this…
Michal
  • 2,078
  • 19
  • 29
14
votes
1 answer

What does boost::asio::spawn do?

I am unable to form a mental picture of how the control flow happens with spawn. When I call spawn(io_service, my_coroutine), does it add a new handler to the io_service queue that wraps a call to the my_coroutine? When inside the coroutine I call…
CppNoob
  • 2,322
  • 1
  • 24
  • 35
14
votes
2 answers

SSL certificates and Boost asio

Hello I'm trying to download content from webpage that uses https via C++. My very basic client program taken from the Boost asio examples compiles and runs fine, but when I test it eg with Google: www.google.co.uk/?gws_rd=ssl, it gives me the error…
Jez
  • 175
  • 1
  • 1
  • 10
14
votes
2 answers

difference between socket.connect and boost::asio::connect

I'm using boost::asio for network communication and I'm wondering why in the examples sometimes the socket.connect(endpoint) and some other times the boost::asio::connect(socket, endpoint) is used. According to the code boost::asio::connect is…
user1810087
  • 5,146
  • 1
  • 41
  • 76
14
votes
2 answers

boost::asio async server design

Currently I'm using design when server reads first 4 bytes of stream then read N bytes after header decoding. But I found that time between first async_read and second read is 3-4 ms. I just printed in console timestamp from callbacks for measuring.…
Denis Ermolin
  • 5,530
  • 6
  • 27
  • 44
14
votes
1 answer

Boost::asio, Shared Memory and Interprocess Communication

I have an application that is written to use boost::asio exclusively as its source of input data as most of our objects are network communication based. Due to some specific requirements, we now require the ability to use shared memory as an input…
Chad
  • 18,706
  • 4
  • 46
  • 63
13
votes
2 answers

boost::asio::ip::multicast::join_group does not work

I tried the example, but it does not work. Apparently it does not set IPPROTO_IP/IP_MULTICAST_IF option. I can only find boost::asio::ip::multicast::outbound_interface for IPPROTO_IP/IP_MULTICAST_IF, I tried but failed. Is there any way to make…
poordeveloper
  • 2,272
  • 1
  • 23
  • 36
13
votes
4 answers

Scalable server framework in C++

I am looking to write a server application in C++ that is meant to handle tens of thousands of clients simultaneously. It should run under Windows and Linux. I have been looking around for frameworks and libraries and have come across Boost Asio,…
Philip Bennefall
  • 1,477
  • 5
  • 20
  • 33
13
votes
4 answers

Program structure for bi-directional TCP communication using Boost::Asio

First off, I hope my question makes sense and is even possible! From what I've read about TCP sockets and Boost::ASIO, I think it should be. What I'm trying to do is to set up two machines and have a working bi-directional read/write link over TCP…
aardvarkk
  • 14,955
  • 7
  • 67
  • 96
13
votes
3 answers

Does boost::asio::io_service preserve the order of handlers?

Does boost::asio::io_service guarantee that handlers are called in the same order that they are given via post()? I can't find anything saying this in the documentation. Assume that calls to io_service::post are serialized.
jakar
  • 1,031
  • 1
  • 11
  • 22
13
votes
1 answer

enumerating ipv4 and ipv6 address of my cards using boost asio

I am trying to enumerate ipv4 and ipv6 addresses of all the network cards(I have 2 cards) my pc. I am using the following code to do that. using boost::asio::ip::tcp; boost::asio::io_service io_service; tcp::resolver resolver(io_service); …
dev
  • 2,180
  • 2
  • 30
  • 46
13
votes
3 answers

Sending Protobuf Messages with boost::asio

I'm trying to hack a client together in C++ using Google's Protocol Buffers and boost::asio. My problem is that I don't know how I can feed the protobuf message to asio. What I have is this: // set up *sock - works PlayerInfo…
adi64
  • 143
  • 1
  • 7