boost-asio

boost:asio ::UnregisterWaitEx has not been declared

时光毁灭记忆、已成空白 提交于 2019-12-08 02:26:04
问题 I am trying to compile a basic client/server C++ program in eclipse with #include <boost/asio.hpp> using MinGW on Win7 and I get: Description Resource Path Location Type '::UnregisterWaitEx' has not been declared zion line 106, external location: C:\boost_1_55_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem I included the path C:\boost_1_55_0 as well as the libraries boost_system and boost_asio. Console output: 14:00:24 **** Incremental Build of configuration Debug for

c++ Boost asio error: no shared cipher

本小妞迷上赌 提交于 2019-12-08 02:13:51
问题 I am currently setting a RESTful API with boost asio. Connecting from a client works fine via HTTP. But if I try to connect via HTTPS I get an error on the server side: "no shared cipher". The error seems to come from the openssl implementation, but I have no idea what to make of it. My first guess would be that that no cypher algorithm is set, but I cannot see how this can be done in asio. This is what I put in the code and where the error occurs: auto acceptHandler = boost::bind(&self:

Set timeout for boost socket.connect

梦想的初衷 提交于 2019-12-08 01:52:38
问题 I am using boost::asio::connect on a tcp::socket . When all goes fine, the connect returns immediately but on a poor network, the connect times out after a log wait of 15 seconds. I cannot afford to wait that long and so want to reduce the timeout. Unfortunately I have not come across any solution so far. I see solutions where async_wait is been used together with deadline_timer but all those examples are for receive / send operations and not for connect. Can anyone help me with a sample code

HTTPS POST request with boost asio

ε祈祈猫儿з 提交于 2019-12-08 00:41:00
问题 I'm looking at this example for making HTTP POST requests. I'm interested about making an HTTPS POST request. How do I provide the location of .crt and .key file? Is there any example, possibly showing exception handling as well? 回答1: Here's the groundwork for a simple POST request. If you define DEMO_USING_SSL you'll get SSL, otherwise no SSL The line ctx.set_default_verify_paths(); sets the verification paths so you should (normally/usually) pick up the system root certificates as trusted.

My server exited with code 137

醉酒当歌 提交于 2019-12-07 18:00:16
问题 I wrote a C++ server/client pair using C++11, boost::asio and HDF5. The server was running fine for a some time (2 days), and then it stopped with code 137. Since I executed the server with an infinite loop, it was restarted. Unfortunately, my error logs don't provide sufficient information to understand the problem. So I've been trying to understand what this code means. It seems there's consensus that this means it's an error of 128+9 , with 9 meaning that the program was killed with kill

Why is there no asio::ssl::iostream? (and how to implement it)

家住魔仙堡 提交于 2019-12-07 15:52:11
问题 I'am currently exploring the Asio library and have working code for regular TCP connections. I used asio::ip::tcp::iostream objects since stuff I want to transmit already can serialize to/deserialize from iostreams, so this was really handy and worked well for me. I then tried to switch to SSL connections and that's when everything turned crazy. There is apparently no built-in support to get the same iostream interface that all other protocols support for a secured connection. From a design

boost asio with ECDSA certificate issue

為{幸葍}努か 提交于 2019-12-07 13:22:43
问题 I am implementing SSL server using boost::asio. The context initialization is shown in below code boost::asio::ssl::context_base::method SSL_version = static_cast<boost::asio::ssl::context_base::method>(param_values[ID_PROTOCOL_VERSION].int32_value); // load certificate files boost::shared_ptr<boost::asio::ssl::context> context_ = boost::shared_ptr<boost::asio::ssl::context>( new boost::asio::ssl::context(SSL_version)); p_ctx = boost::static_pointer_cast<void>(context_); context_->set_options

Inline ntohs() / ntohl() in C++ / Boost ASIO

妖精的绣舞 提交于 2019-12-07 11:57:00
问题 Hi I'm using C++ / Boost ASIO and I have to inline ntohl() for performance reasons. Each data packet contains 256 int32s, hence a lot of calls to ntohl() . Has anyone done this? Here is the compiled assembly output out of VC10++ with all optimizations turned on: ; int32_t d = boost::asio::detail::socket_ops::network_to_host_long(*pdw++); mov esi, DWORD PTR _pdw$[esp+64] mov eax, DWORD PTR [esi] push eax call DWORD PTR __imp__ntohl@4 I've also tried the regular ntohl() provided by winsock. Any

How game servers with Boost:Asio work asynchronously?

醉酒当歌 提交于 2019-12-07 08:50:57
问题 I am trying to create a game server, and currently, I am making it with threads. Every object( a player , monster ), has its own thread with while(1) cycle , in witch particular functions are performed. And the server basically works like this: main(){ //some initialization while(1) { //reads clients packet //directs packet info to a particular object //object performs some functions //then server returns result packet back to client Sleep(1); } I have heard that is not efficient to make the

Synchronous TCP Read in Node.js

蓝咒 提交于 2019-12-07 08:47:33
问题 Is there a way to do a synchronous read of a TCP socket in node.js? I'm well aware of how to do it asynchronously by adding a callback to the socket's 'data' event: socket.on('data', function(data) { // now we have the string data to do whatever with }); I'm also aware that trying to block with a function call instead of registering callbacks goes against node's design, but we are trying to update an old node module that acts as a client for my university while maintaining backwards