I've got an application, written in C++, that uses boost::asio. It listens for requests on a socket, and for each request does some CPU-bound work (e.g. no disk or network i/o), and then responds with a response.
This application will run on a multi-core system, so I plan to have (at least) 1 thread per core, to process requests in par...
I'm implementing a basic HTTP Server in C++, using boost::asio.
As I process each request, I write out the data in chunks, asychronously. If at any point I knew the client was no longer connected, I'd like to abort the processing, e.g. there's no point continuing to build results up to send out if the client is no longer there.
I thin...
I have a quick and dirty proof of concept app that I wrote in C# that reads high data rate multicast UDP packets from the network. For various reasons the full implementation will be written in C++ and I am considering using boost asio. The C# version used a thread to receive the data using blocking reads. I had some problems with dro...
There seems to be a conflict with the windows headers between the mysql c-api and boost::asio.
If I include mysql first I get:
boost/asio/detail/socket_types.hpp(27) : fatal error C1189: #error : WinSock.h has already been included
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
# if defined(_WINSOCKAPI_) && !defined(_WINSOCK2A...
I have read the boost asio reference, gone through the tutorial and looked at some of the examples. Still, I am unable to see how a socket should be torn down:
Should I call close() or is this done by the socket's destructor?
When should I call shutdown()
What are the effects of shutdown()?
I am aware that it "Disables sends or recei...
For some reason this results in an access violation, however not having any detailed documentation/help on this I'm not sure where I'm doing it wrong, since going by what ive seen on the boost site this should be correct, and print the contents of each asio::write call from the client to a new line... the client seems to work fine, altho...
What is the difference between calling boost::asio::ip::tcp::socket's read_some/write_some member functions and calling the boost::asio::read/boost::asio::write free functions?
More specifically:
Is there any benefit to using one over the other?
Why are both included in the library?
...
For some reason both the mast and slave fail, however I could find any good examples on how their meant to work, so im not sure where I went wrong.
The master never exits the WaitForSingleObject after ConnectNamedPipe, and the slave throws an exception in the first boost::asio::read call, "Waiting for a process to open the other end of...
I'm writing server using boost.asio. I have read and write buffer for each connection and use asynchronized read/write function (async_write_some / async_read_some).
With read buffer and async_read_some, there's no problem. Just invoking async_read_some function is okay because read buffer is read only in read handler (means in same thr...
hello,
I would like to use a function which reads on a socket port, and gives back the control whenever an IP packet is received.
the boost::asio::ip::udp::socket has a function receive (or async_receive) that returns how many bytes were read.
the doc states: Receive some data on a connected socket.
now what determines the 'some' da...
Hi,
I am trying to run blocking_udp_echo_server.cpp from Boost asio example on MacOSX 10.5.
But it crashes:
From the console:
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:
error: attempt to copy-construct an iterator from a singular iterator.
Objects involved in the operation:
iterator "this" @ 0...
any ideas why stream.flush(); won't work?
boost::asio::ip::tcp::iostream stream("localhost","5000");
assert(stream.good());
stream << 1;
stream.flush();
while(true);
it's only flushed if the loop is removed and the line
boost::this_thread::sleep(boost::posix_time::seconds(1));
is executed (much later).
Thanks
Update:
I did some ...
I have code that looks like the following:
//unrelated code snipped
resolver.reset(new tcp::resolver(iosvc));
tcp::resolver::query query(host, port);
resolver->async_resolve(query,
boost::bind(&TCPTransport::handle_resolve, this,
boost::asio::placeholders::error,
boost::asio::placeholders::iterator));
LOG4CXX_INFO(logge...
I am trying to build a project using Boost's Asio and I am having some trouble. Initially, I tried to build the project without any additional libraries since everything is supposedly in the header files.
The program I am trying to build looks like this:
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_tim...
I want to verify the connection status before realize my operations (read/write).
Is there a way to make an isConnect() method?
I saw this, but it seems "ugly".
I tested is_open() function also, but doesn't have the expected behavior.
Thanks
...
Hi,
in a project we want to wrap the Boost Asio socket in a way, that the using class or the wrapping .h does not have to include the boost headers.
We usually use pointers and forward declarations for wrapped classes.
Foward declaration:
namespace boost
{
namespace asio
{
namespace ip
{
class udp;
}
}
}
And...
So,
I've been playing around with the Boost asio functions and sockets (specifically the async read/write). Now, I thought that boost::asio::async_read only called the handler when a new buffer came in from the network connection... however it doesn't stop reading the same buffer and thus keeps calling the handler. I've been able to m...
I am merely trying to create a boost ip::tcp::socket from an existing native socket. In the assign function, the first parameter must be a "protocol_type" and the second must be a "native_type", but it never explains what these are or gives an example of its use.
I'm guessing the second should be the socket descriptor, but I'd really ap...
I'm struggling with two errors with Boost.Asio.
The first occurs when I try to receive data on a socket:
char reply[1024];
boost::system::error_code error;
size_t reply_length = s.receive(boost::asio::buffer(reply, 1024), 0, error);
if (error) cout << error.message() << endl; //outputs "End of file"
The second occurs when I try to cr...
Hello Everyone!
I have a project that uses Boost.Asio and the Media-Decoding-Samples that come with the Intel IPP-Library. The problem is the following. If I compile the project without defining WIN32_LEAN_AND_MEAN, Asio complains with the infamous "winsock.h already included" error. If I define the macro, a header in the other library ...