Category : asio

I tried to compile a project but it failed with the following error: Build Error Below is the code in my project: boost::system::error_code ec; auto endpoints = resolver->resolver().resolve(ip_address, std::to_string(port)), ec); if (ec) return; // Connect to server boost::asio::ip::tcp::endpoint m_endpoint; m_endpoint = *(boost::asio::connect(_socket, endpoints.begin(), endpoints.end(), ec)); The problem occurs in the call to boost::asio::connect function. By ..

Read more

I’m migrating my app from boost 1.72 to boost 1.75. The code was working with 1.72. but not for 1.75 I got this strange error when including boost/asio/ssl: boost/asio/ssl/impl/host_name_verification.ipp : error X509_check_ip_asc was not declared in this scope Have you any idea ? Thanks Source: Windows Que..

Read more

For a client side application, I wish to serialize http post requests using strand, in order to avoid overlapping writes/ responses to/from the server. Serialization is made using boost::asio, by calling the method as a callback from strand.post as shown below. Notice that inside each http session (write request and read it’s response, is made ..

Read more

I’d like to serialize http post requests using strand, to avoid overlapping writes to network. My approach was to call the post method from the strand object with the callback that send the data as can be shown in the following code : void Send( boost::beast::http::request<boost::beast::http::string_body> &req) { strand_.post([=]() { … boost::beast::http::write(stream_, req); … } ..

Read more

I am trying to get My modem IPV4 by using boost Asio and c++, For doing this I try this code : try { boost::asio::io_service netService; udp::resolver resolver(netService); udp::resolver::query query(udp::v4(), "google.com", ""); udp::resolver::iterator endpoints = resolver.resolve(query); udp::endpoint ep = *endpoints; udp::socket socket(netService); socket.connect(ep); boost::asio::ip::address addr = socket.local_endpoint().address(); std::cout << "My IP according to google is: ..

Read more

So currently I am following a tutorial on writing sockets using ASIO on youtube https://www.youtube.com/watch?v=2hNdkYInj4g&ab_channel=javidx9, really great guy. I am not sure the proper way to ask questions. Here goes… So I have 2 projects, first project NetCommon, I have created a header file, olc_net.h to include all header files In tutorial he just links ..

Read more