New Solutions

Boost asio with Qt

I am trying to use boost::asio async client example with a simple Qt GUI like: A little snippet from my app: The button click SLOT: void RestWidget::restGetCall() { networkService ntwkSer("www.boost.org","80"); connect(&ntwkSer, SIGNAL(responseReady(std::string)), this, SLOT(showResponse(std::string))); ntwkSer.get("/LICENSE_1

it1352 0 2020-09-22

Compare boost::system::error_category

The following comparison fails for an error whom outputs "asio.misc" for errorCode.category().name() and "end of file" for errorCode.message() If it claims to be in category asio.misc, then why does the if condition of (errorCode.category() == boost::asio::error::misc_category ) evaluate to false? Googling (including answers here) says that a boo

it1352 0 2020-09-22

Boost Asio https synchronous call- Error code 400 bad request

we are migrating from http to https boost asio sysnchornous call and I am using the below code to make https synchoronous call with ssl certificate validation. we got our client certificate issued by certiticate authority and we downloaded it in .pem format. we have the following questions: 1.) how to load the certificates in boost asio; can we loa

it1352 0 2020-09-22

Boost Asio SSL Certification on iOS

I am trying to use Boost Asio on iOS, and have figured out everything, but how to check the certificate of the server I am connecting to. How do you check the connecting server's certificate in iOS with Boost Asio? Solution In another answer of mine you can see a simple SSL client. In this code you'll quickly note verify_certificate which you c

it1352 1 2020-09-22

Simple interface for getting HTML content in Boost.Asio

There are a lot of examples how to make HTTP request to a server and get reply via boost.asio library. However, I couldn't find a good example of simple interface and wondering, if I need to implement it myself. For instance, if I need to get content of http://www.foo.bar/path/to/default.html, is there any way to get a content without validating U

it1352 0 2020-09-22

boost asio - connect using an ip address

I want to connect to a server socket specified by a destination ip address and port number. boost::asio::connect seems it does not allow to use this. I have ip destination as a unsigned int value. Update: I am able to do ba::ip::tcp::endpoint endpoint( ba::ip::address(ba::ip::address_v4(req.IpDst())), ntohs(req.Port())); But how can I use endp

it1352 0 2020-09-22

Why doesn't this Boost ASIO code work with this python client?

This code is identical to the original udp async echo server, but with a different socket. The response is transmitted and showing in wireshark, but then an ICMP Port Unreachable error is sent back to the server. I'm trying to understand why because everything looks correct. You can copy this code directly into a source file e.g. server.cpp. and

it1352 0 2020-09-22

boost::asio::async_read_until not calling handler

I'm learning how to use Boost:asio library with Serial Port. I wrote some code using synchrous write and read and I now want to use asynchrous but it's not working. Simple Example: void readHandler(const boost::system::error_code&,std::size_t); streambuf buf; int main(int argc,char *argv[]){ io_service io; serial_port port(io,PORT);

it1352 0 2020-09-22

Reading messages from a serial port with Boost Asio

I would like to use Boost Asio to read variable length messages from the serial port. I would like to read and wait long enough to be sure that the line is idle, but I do not want to block completely. The following code is what I have so far, and I am in the process of testing it: long readData(void *_pData, unsigned long _uSize, size_t millis) {

it1352 0 2020-09-22