boost-asio

Boost linker error: Unresolved external symbol “class boost::system::error_category const & __cdecl boost::system::get_system_category(void)”

て烟熏妆下的殇ゞ 提交于 2019-12-17 09:45:53
问题 I'm just getting started with Boost for the first time, details: I'm using Visual Studio 2008 SP1 I'm doing an x64 Build I'm using boost::asio only (and any dependencies it has) My code now compiles, and I pointed my project at the boost libraries (after having built x64 libs) and got past simple issues, now I am facing a linker error: 2>BaseWebServer.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)"

Why does Boost.Asio not support an event-based interface?

£可爱£侵袭症+ 提交于 2019-12-17 09:17:31
问题 I am attempting to understand Boost.Asio, with the intention of potentially implementing a signaling system using condition variables in conjunction with Boost.Asio. I have seen the other StackOverflow questions boost asio asynchronously waiting on a condition variable, boost::asio async condition, and boost condition variable issue, but none of these questions/answers have satisfactorily touched on an essential question that I have: Is it true that, and/or is there a fundamental reason why,

boost::asio and Active Object

ぃ、小莉子 提交于 2019-12-17 08:54:34
问题 I have implemented some module based Active Object design pattern. It is very simple implementation. I have Scheduler, ActivationList, Requests and Futures to get response. My requirements were like that: Access to active object shall be serialized by executing its methods within its own thread (main req and assumption of Active Object design pattern) Caller shall be able to specify the priority of requests execution. It means that if there is more than zero requests waiting for execution,

boost::asio and Active Object

廉价感情. 提交于 2019-12-17 08:54:08
问题 I have implemented some module based Active Object design pattern. It is very simple implementation. I have Scheduler, ActivationList, Requests and Futures to get response. My requirements were like that: Access to active object shall be serialized by executing its methods within its own thread (main req and assumption of Active Object design pattern) Caller shall be able to specify the priority of requests execution. It means that if there is more than zero requests waiting for execution,

What is the proper way to securely disconnect an asio SSL socket?

吃可爱长大的小学妹 提交于 2019-12-17 07:32:52
问题 A boost-asio SSL/TLS TCP socket is implemented as an ssl::stream over a tcp::socket : boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_socket; In the TLS protocol, a cryptographically secure shutdown involves parties exchanging close_notify messages. Simply closing the lowest layer may make the session vulnerable to a truncation attack. In boost asio ssl async_shutdown always finishes with an error? @Tanner Sansbury describes the SSL shutdown process in detail with a number of

Copy a streambuf's contents to a string

与世无争的帅哥 提交于 2019-12-17 07:11:37
问题 Apparently boost::asio::async_read doesn't like strings, as the only overload of boost::asio::buffer allows me to create const_buffer s, so I'm stuck with reading everything into a streambuf. Now I want to copy the contents of the streambuf into a string, but it apparently only supports writing to char* ( sgetn() ), creating an istream with the streambuf and using getline() . Is there any other way to create a string with the streambufs contents without excessive copying? 回答1: I don't know

Thread pool using boost asio

老子叫甜甜 提交于 2019-12-17 06:26:09
问题 I am trying to create a limited thread pool class using boost::asio. But I am stuck at one point can some one help me. The only problem is the place where I should decrease counter? code does not work as expected. the problem is I don't know when my thread will finish execution and how I will come to know that it has return to pool #include <boost/asio.hpp> #include <iostream> #include <boost/thread/thread.hpp> #include <boost/bind.hpp> #include <boost/thread/mutex.hpp> #include <stack> using

How to set a timeout on blocking sockets in boost asio?

岁酱吖の 提交于 2019-12-17 04:30:44
问题 Is there a way to cancel a pending operation (without disconnect) or set a timeout for the boost library functions? I.e. I want to set a timeout on blocking socket in boost asio? socket.read_some(boost::asio::buffer(pData, maxSize), error_); Example: I want to read some from the socket, but I want to throw an error if 10 seconds have passed. 回答1: Under Linux/BSD the timeout on I/O operations on sockets is directly supported by the operating system. The option can be enabled via setsocktopt()

How to create a thread pool using boost in C++?

旧巷老猫 提交于 2019-12-17 00:47:52
问题 How do I create a thread pool using boost in C++, and how do I assign tasks to the threadpool? 回答1: The process is pretty simple. First create an asio::io_service and a thread_group. Fill the thread_group with threads linked to the io_service. Assign tasks to the threads using the boost::bind function. To stop the threads (usually when you are exiting your program) just stop the io_service and join all threads. You should only need these headers: #include <boost/asio/io_service.hpp> #include

How to create a thread pool using boost in C++?

霸气de小男生 提交于 2019-12-17 00:47:23
问题 How do I create a thread pool using boost in C++, and how do I assign tasks to the threadpool? 回答1: The process is pretty simple. First create an asio::io_service and a thread_group. Fill the thread_group with threads linked to the io_service. Assign tasks to the threads using the boost::bind function. To stop the threads (usually when you are exiting your program) just stop the io_service and join all threads. You should only need these headers: #include <boost/asio/io_service.hpp> #include