boost-asio

Has anyone done a performance analysis of boost::asio?

蹲街弑〆低调 提交于 2019-11-30 06:43:55
I require socket-like local IPC. I used named pipes and overlapped IO on windows and I want to rewrite the application to boost::ASIO so that it can use UNIX domain sockets as well. I've recently reviewed parts of the libevent library and I know it only supports socket() and select() for windows in the 1.4 version. As overlapped IO is very efficient leaving it out is obviously an unacceptable trait which is being adressed in version 2 (which is in alpha). Another example of sub-optimal implementation is the use of red-black trees vs. prio-queues for the timeout logic which was adressed

Boost::asio - how to interrupt a blocked tcp server thread?

最后都变了- 提交于 2019-11-30 06:24:56
问题 I'm working on a multithreaded application in which one thread acts as a tcp server which receives commands from a client. The thread uses a Boost socket and acceptor to wait for a client to connect, receives a command from the client, passes the command to the rest of the application, then waits again. Here's the code: void ServerThreadFunc() { using boost::asio::ip::tcp; boost::asio::io_service io_service; tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v4(), port_no)); for (;;) { //

Can I use a stackful coroutine as the wait handler of a steady_timer which is defined inside the very stackful coroutine?

痴心易碎 提交于 2019-11-30 05:18:36
问题 Can I use stackful coroutine and boost::asio::steady_timer::async_wait in the following way? The point is that (my understanding, not sure) during waiting, local variable timer is not on the stack and thus inaccessible. So can the callback proceed normally? (FYI, it works fine on my Mac using clang++5.0 .) boost::asio::io_service io; void Work(boost::asio::yield_context yield) { boost::asio::steady_timer timer(io); timer.expires_from_now(std::chrono::seconds(5)); timer.async_wait(yield); cout

SSL certificates and Boost asio

会有一股神秘感。 提交于 2019-11-30 05:18:29
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 "handshake: certificate verify failed". I think this is because ctx.set_default_verify_paths() doesn't contain a path with a certificate for Google (I'm on Windows). I'm very new to SSL, please can you help me with the following questions: 1) When I installed openSSL, did it stick a list of trusted certifying authorities on my computer? If it did,

Boost.Asio async_send question

一个人想着一个人 提交于 2019-11-30 04:55:19
问题 I'm using Boost.Asio for a server application that I'm writing. async_send requires the caller to keep ownership of the data that is being sent until the data is sent successfully. That means my code (which looks like the following) will fail, and it does, because data will no longer be a valid object. void func() { std::vector<unsigned char> data; // ... // fill data with stuff // ... socket.async_send(boost::asio::buffer(data), handler); } So my solution was to do something like this: std:

Boost::asio winsock and winsock 2 compatibility issue

谁说我不能喝 提交于 2019-11-30 03:53:10
My project uses windows.h in which winsock.h is used, and I need to include boost:assio which uses winsock2. So I get many errors that says Winsock.h already included. I can define WIN32_LEAN_AND_MEAN. so that windows.h wouldn't use winsock. The problem is , that I need windows.h to use it, and I just need Asio for asynchronous timers. I don't need its winsock2.h . I tried searching how to disable its winsock2 use, and I found that I could do that by defining BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN before including boost:asio, but I still get the same error. #include <windows.h> #define BOOST_ASIO

How to decipher a boost asio ssl error code?

左心房为你撑大大i 提交于 2019-11-30 03:27:48
问题 I've got an occasional communications failure in a boost asio ssl implementation, the super helpful error message returned by boost is 'asio.ssl:336458004' I suspect that the numerical figure is some sort of aggregate construct composed of SSL flags, I say that because the linux error codes, the boost asio error codes and the ssl error codes do not have any reference to '336458004', so presumably it must be constructed dynamically. Can anyone provide some insight into how I should decipher

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

て烟熏妆下的殇ゞ 提交于 2019-11-30 03:19:02
问题 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 boost::asio::ip::multicast work without calling c-level setsockopt? boost::asio::ip::udp::endpoint listen_endpoint( listen_address, multicast_port); socket_.open(listen_endpoint.protocol()); socket_.set_option(boost::asio::ip::udp::socket::reuse

library not found for -lboost_system

时光总嘲笑我的痴心妄想 提交于 2019-11-30 03:12:14
问题 I installed boost using macports. The files appear to be in /opt/local/include/boost/ My makefile is no longer working and I get the following error Undefined symbols: "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in client.o __static_initialization_and_destruction_0(int, int)in client.o "boost::system::system_category()", referenced from: boost::asio::error::get_system_category() in client.o boost::system::error_code::error_code()in

How do you post a boost packaged_task to an io_service in C++03?

大兔子大兔子 提交于 2019-11-30 03:11:27
问题 This is a follow-on from a previous question (here), but I'm working on a multithreaded application and I would like to post a Boost packaged_task to a threaded io_service. I'm stuck using a C++03 compiler (so std::move is out), and the packaged_task is not copyable. I've tried wrapping it in a shared_ptr and passing that, and a lot of other things. Here is my current attempt and the subsequent compiler errors. Any idea how to get this to work? boost::asio::io_service io_service; boost: