boost-asio

boost condition variable issue

£可爱£侵袭症+ 提交于 2019-12-10 13:57:26
问题 The following minimal code sample of a larger program sends commands from client threads to an asio io_service object. The io_service object (in the Ios class) is being run with one thread. When the command is sent the client thread waits until it is notified by the Ios object (via Cmd::NotifyFinish()) that it is completed. This sample seems to run on Linux Ubuntu 11.04 with boost 1.46 fine but on Windows 7 boost 1.46 it asserts. I suspect it is something to do with the lock in Cmd:

Serializing binary data in boost fails with `invalid signature' error

时光总嘲笑我的痴心妄想 提交于 2019-12-10 11:42:52
问题 I'm having difficulties figuring out correct way of using boost serialization/asio to send objects over network. The message class is as simple as possible. It's not C++ friendly nor suitable for my needs, I just keep it simple temporarily to test asio/ser: class message { friend class boost::serialization::access; public: message(){} int type; int sender; int assignment; int nogood; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & type; ar & sender; ar

Boost.Asio SSL context load_verify_paths not loading certificate(s)

荒凉一梦 提交于 2019-12-10 11:39:57
问题 I have code to retrieve all root certificates in the Windows certificate store for the current user: #include <windows.h> #include <Wincrypt.h> inline std::vector<std::string> system_root_certificates() { std::vector<std::string> certs; HCERTSTORE hStore; PCCERT_CONTEXT pCertContext = NULL; if (!(hStore = ::CertOpenStore( CERT_STORE_PROV_SYSTEM_A, 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER, "Root"))) return certs; do { if (pCertContext = ::CertFindCertificateInStore( hStore, X509_ASN_ENCODING |

Boost asio: Send OpenCV IplImage from Ubuntu-Server to Win7-Client

筅森魡賤 提交于 2019-12-10 10:55:16
问题 I try to transmit an OpenCV IplImage from a Server (Ubuntu x64) to a Client (Win7 x64) using the boost asio library. The following code works fine if both (Client and Server) are on the same operating system. But when the server is on Ubuntu and the client on Win7 it doesn't work. The image header is correct, but something with the image data is wrong. I think this is because of the different bit-order between the two OS. Is it? How can I resolve this problem? And second: The transmission

Boost asio priority and strand

半世苍凉 提交于 2019-12-10 10:47:47
问题 I want to use boost asio for a message queue. I want to do different operations on different objects. The operations have a priority. So if there is a operation oft type A none of type B should be executed. To my understanding this is what the priority example in the boost dokumentation does. But what I as well need is, if there is one operation running in one object, i do not want to execute another operation in the same object. Is this something that can be done with boost asio? 回答1: The

Verbosity in boost asio using ssl

[亡魂溺海] 提交于 2019-12-10 10:19:50
问题 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. 回答1: I found that boost.asio with ssl use openssl. I just need to recompile the libssl with debug flags to make ssl handshake process more verbose. I can do this just reconfiguring with './config -DKSSL_DEBUG'. In the boost documentation I found no way to control the verbosity level. 来源: https:/

Opening multiple ports using Boost Asio libraries

霸气de小男生 提交于 2019-12-10 10:15:52
问题 I am a newbie for Boost Asio libraries, my requirement is to build a server, which should listen on 600 different ports asynchronously (TCP communication). Can someone suggest me a smart way to achieve this using Boost Asio. I have tried using echo server example provided at Boost Asio documentation but could not really understand much boost::asio::io_service io_service; using namespace std; // For atoi. for(long port=50000;port<=50600;port++) { server s(io_service, port); io_service.run(); }

boost asio stateful server design

末鹿安然 提交于 2019-12-10 09:59:44
问题 I am writing a Server application on boost::asio Here I instantiate a Server that owns an io_service Server is started by server.start() method which calls Server::accept() and that creates a new Session even before it gets a new connection Calls _acceptor.async_accept thats set a callback that calls Session::handler() method which does the handshaking. Now is it okay to create a socket even before getting a new client ? and in this code the Session is auto destructed after writing an "Hello

Boost.Asio socket destructor closes connection?

一曲冷凌霜 提交于 2019-12-10 04:15:08
问题 What exactly does the destructor of boost::asio::ip::tcp::socket do? I can't tell, even after scouring Boost docs and source code, if I need to use socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both); socket->close(); before calling delete socket; Do I need to close the socket manually, or does the destructor handle this? 回答1: When a socket is destroyed, it will be closed as-if by socket.close(ec) during the destruction of the socket. I/O objects, such as socket , derive from basic

Boost.Asio installation issue

与世无争的帅哥 提交于 2019-12-10 02:59:03
问题 i have already installed boost libraries with bjam install, but when i'm compiling programme: #include boost/asio.hpp int main() { return 0; } such errors occur: /tmp/ccVR3eeF.o: In function `__static_initialization_and_destruction_0(int, int)': sda.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' sda.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' sda.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp