I am trying to convert some existing code to use boost's asio tcp sockets instead of our current implementation. I am able to get a very similar example (of a chat client/server) from the boost site working, but when I attempt to put the code into my own program it stops working.
What I am doing:
Start a server process
The server p...
This simple example fails to compile in VS2K8:
io_service io2;
shared_ptr<asio::deadline_timer> dt(make_shared<asio::deadline_timer>(io2, posix_time::seconds(20)));
As does this one:
shared_ptr<asio::deadline_timer> dt = make_shared<asio::deadline_timer>(io2);
The error is:
error C2664: 'boost::asio::basic_deadline_time...
I've recently returned to C/C++ after years of C#. During those years I've found the value of Mocking and Unit testing.
Finding resources for Mocks and Units tests in C# is trivial. WRT Mocking, not so much with C++.
I would like some guidance on what others do to mock and test Asynch io_service handlers with boost.
For instance, in ...
What I mean is, let's say you do an async_wait on an asio timer and bind the update to a function that takes a reference to a type T. Let's say you created the T initially on the stack before passing it to async_wait. At the end of that async_wait, it calls async_wait itself, renewing the timer over and over. Does that stack allocated ty...
Is there a way to make ssl handshake more visible to me using boost asio?
I am getting an error: "asio.ssl error".
I just want more verbosity, because this message means almost nothing to me.
Thanks.
...
There is a line in the 3rd tutorial on Boost asio that shows how to renew a timer and yet prevent there from being drift. The line is the following:
t->expires_at(t->expires_at() + boost::posix_time::seconds(1));
Maybe it's me but I wasn't able to find documentation on the 2nd usage of expires_at(), with no parameters. expires_at(x) ...
I am working on a UDP server built with boost::asio and I started from the tutorial customizing to my needs. When I call socket.receive_from(boost::asio::buffer(buf), remote, 0, error); it fills my buffer with data from the packet, but, if my understanding is correct, it drops any data that won't fit in the buffer. Subsequent calls to re...
Hi, I'm trying to learn a little bit C++ and Boost.Asio. I'm trying to compile the following code example:
#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>
using boost::asio::ip::tcp;
int main(int argc, char* argv[])
{
try
{
if (argc != 2)
{
std::cerr << "Usage: client <host>" << std::endl;
...
I am using Boost's ASIO libraries to establish a UDP connection to a remote server. To make sure the connection is active, every second a keep-alive message is sent to the server.
I have noticed that if I unplug the network cable and reinsert it quickly, the first 2 or 3 keep-alive messages after the reinsert are never sent. I tested t...
Hi there,
For my bachelors thesis, I am implementing a distributed version of an algorithm for factoring large integers (finding the prime factorisation). This has applications in e.g. security of the RSA cryptosystem.
My vision is, that clients (linux or windows) will download an application and compute some numbers (these are indepen...
Hello
In my work, I'm developing a Viewer client for a Offshore simulation server, using sockets to send the simulation data from the Simulator to de Viewer.
But, the server uses Boost.asio as it's sockets library. As the client uses Qt for it's GUI, I was wondering if there is any problem in using de Qt Networking library for handling...
Hey,
I'm currently searching for a portable way of getting the local IP-addresses. Because I'm using Boost anyway I thought it would be a good idea to use Boost.Asio for this task.
There are serveral examples on the net which should do the trick. Examples:
Official Boost.Asio Documentation
Some Asian Page
I tried both codes with jus...
This is for the purpose of a client/server program. The client asks for some data off the server, and receives it. Upon receiving this data from a Boost socket on the client side, I handle this message in a static method called parse_message in a class called client_protocol.
This method, given this specific data, will start a process o...
Using boost 1.4.2 asio in a c++ app and getting linux compiler warnings i don't grok.
still here?
The app i'm working on needs a "socket" that might be an ssl socket or a regular tcp socket so we hide specifics
behind a template "socket" class that takes either an ssl socket class or
tcp socket class as template parameter - below is the...
So I have these two classes, mpqs_client and client_protocol. The mpqs_client class handles a Boost socket connection to a server (sending and receiving messages with some specific format. Upon receiving a message, it calls a static method, parse_message(..), in the class client_protocol, and this method should analyse the message receiv...
I know that boost.asio has a mechanism that calls a callback function whenever a packet is received but is there an option to emit a signal instead?
Do I have to write a function that emits the signal?
If it is so, why?
...
I was going over the examples of boost.asio and I am wondering why there isn't an example of a simple server/client example that prints a string on the server and then returns a response to the client.
I tried to modify the echo server but I can't really figure out what I'm doing at all.
Can anyone find me a template of a client and a te...
My program appears to run just fine most of the time, but occasionally I get a segmentation fault.
boost version = 1.41.0
running on RHEL 4
compiled with GCC 3.4.6
Backtrace:
#0 0x08138546 in boost::asio::detail::posix_fd_set_adapter::is_set (this=0xb74ed020, descriptor=-1)
at /home/scottl/boost_1_41_0/boost/asio/detail/posix_f...
Referencing an old (from 2008) discussion:
There is a compile error when trying to use boost::asio::local::stream_protocol::iostream
There was no solution on the discussion forum and I've run into the same problem, it seems.
Has there been a fix or solution for the compile error? How can I use
boost::asio::local::stream_protocol::iost...
Is there a known algorithm for implementing a connection pool? If not what are the known algorithms and what are their trade-offs?
What design patterns are common when designing and programming a connection pool?
Are there any code examples implement a connection pool using boost.asio?
Is it a good idea to use a connection pool for persi...