boost-asio

Multiple Http Servers with Poco and Boost C++

好久不见. 提交于 2019-12-05 05:40:55
问题 I'm trying to create multiple Http servers with Poco::Net and Boost libraries, but is occurring the following error internally in Poco file Application.cpp : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Assertion violation: _pInstance == 0 [in file "src/Application.cpp", line 115] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I'm using the code below: #include <Poco/Net/HTMLForm.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerResponse.h> #include <boost/asio/io_service.hpp>

boost.asio linking and libraries

∥☆過路亽.° 提交于 2019-12-05 05:08:40
问题 I'm new to boost.asio programming and i have difficulties linking boost libraries. My question is that how to find out which libraries I should link to my project when I include asio headers. For example I used #include <boost/date_time/posix_time/posix_time.hpp> and #include <boost/asio.hpp directives. so this is my command to compile it: g++ -I /usr/local/boost_1_55_0 ASIO.cpp -o HELLO -L /usr/local/lib/ -l boost_system consider my boost library is installed on /usr/local/boost_1_55_0 and

Boost.Asio installation issue

血红的双手。 提交于 2019-12-05 04:48:54
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/ccVR3eeF.o: In function `boost::asio::error::get_system_category()': sda.cpp:(.text.

boost:asio IPv4 address and UDP comms

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:57:27
Problem Solved - See bottom for solution notes I'm trying to build a simple app to test an ethernet-capable microcontroller. All I want to do is send and receive small UDP packets. The code is using boost::asio for the networking, and is incredibly simple. For debugging I moved all the intialisation out of the constructors so I could check each step. Here's the body of my stuff: boost::system::error_code myError; boost::asio::ip::address_v4 targetIP; targetIP.from_string("10.1.1.75", myError); // Configure output IP address. HACKHACK--Hardcoded for Debugging std::cout << "GetIP - " << myError

Boost SSL verifies expired and self-signed certificates

烂漫一生 提交于 2019-12-05 02:28:03
问题 I'm using Boost's asio to connect to a site via HTTPS. I want this to only succeed if the certificate is valid, not expired, not self-signed, etc. Unfortunately it seems to always work regardless. Here is my code: try { asio::io_service ioService; asio::ssl::context sslContext(asio::ssl::context::sslv3_client); sslContext.load_verify_file("cacert.pem"); asio::ip::tcp::resolver resolver(ioService); asio::ip::tcp::resolver::query query("self-signed.badssl.com", "443"); asio::ip::tcp::resolver:

Payload split over two TCP packets when using Boost ASIO, when it fits within the MTU

Deadly 提交于 2019-12-05 02:16:59
I have a problem with a boost::asio::ip::tcp::iostream. I am trying to send about 20 raw bytes. The problem is that this 20 byte payload is split into two TCP packets with 1 byte, then 19 bytes. Simple problem, why it is happening I have no idea. I am writing this for a legacy binary protocol that very much requires the payload to fit in a single TCP packet (groan). Pasting the whole source from my program would be long and overly complex, I've posted the functional issue just within 2 functions here (tested, it does reproduce the issue); #include <iostream> // BEGIN cygwin nastyness // The

boost::asio over SocketCAN

喜夏-厌秋 提交于 2019-12-05 02:13:44
I was thinking of making use of Boost Asio to read data from a Socket CAN . There's nothing fancy going on in linux/can.h , and the device should behave like the loopback interface, and be used with a raw socket. Looking at the basic_raw_socket interface it seems that I can make use of basic_raw_socket::assign to assign the native socket created with socket( PF_CAN, SOCK_RAW, CAN_RAW ); This is what I have so far namespace can { class CanSocket { public: typedef boost::asio::ip::basic_endpoint<CanSocket> endpoint; typedef boost::asio::ip::basic_resolver_query<CanSocket> resolver_query; typedef

SCons, Boost::ASIO, Windows Precompiled Headers, and Linker Errors

家住魔仙堡 提交于 2019-12-05 02:09:16
问题 I'm investigating using SCons for our build process as we develop C++ for multiple platforms. I'm 99% of the way there in the build configuration, but I'm running into a VERY strange error on Windows having to do with the precompiled header file. Even stranger still is that it only happens on one project. In the SConscript file for this project, I have the following to compile the PCH on windows: if env['PLATFORM'] == 'win32': env['PCH'] = env.PCH('MyPCH-LSCommon.pch', 'Common/src/MyPCH.h')[0

using boost:asio with select? blocking on TCP input OR file update

大城市里の小女人 提交于 2019-12-05 01:45:20
问题 I had intended to have a thread in my program which would wait on two file descriptors, one for a socket and a second one for a FD describing the file system (specifically waiting to see if a new file is added to a directory). Since I expect to rarely see either the new file added or new TCP messages coming in I wanted to have one thread waiting for either input and handle whichever input is detected when it occures rather then bothering with seperate threads. I then (finally!) got permission

Boost Asio how to read/write on a SSL socket that doesnt use SSL?

余生颓废 提交于 2019-12-05 00:16:40
问题 The title is my question. I already found a topic related to this here -> Using SSL sockets and non-SSL sockets simultaneously in Boost.Asio? and basically I'm in the same situation but for some reason I couldn't comment there and/or contact the questioner directly so I'm doing this as a new question. I have a set up ssl socket ssl::stream<ip::tcp::socket> socket_; where clients can connect just fine with socket_.async_handshake(ssl::stream_base::server, session::handle_handshake) and then