I using this git hub project to create a cpp server one of the example. but I am getting error in which the definition in the ipp files. I have included the directory path in the visual studio. I think the visual studio not finding the definition in the .ipp files The link of the ..
Category : asio
i try to call async_read function 2 times because i want to get header and calculate data size after that get data according to calculated size but handler is called 1 time by async_read function. Article said that handler call when buffer was full or error occured. I check buffer and is full but handler ..
Would you please help me spot what I’m doing wrong here. I’m starting to feel like there is a bug or something. The code does something like the following: using namespace boost::asio; using namespace std::chrono; using namespace std::chrono_literals; io_context io; executor_work_guard<io_context::executor_type> keepRunning(io.get_executor()); std::thread t{io::context::run, &io}; steady_timer timer(io); timer.expires_after(100ms); timer.async_wait([](boost::system::error_code){}); // This is technically a one ..
I was writing some asio code and tried to refactor it to use C++20 coroutines. However I got stuck transforming this code: asio::post( my_strand, [self = shared_from_this()]() { /* co_await? */ socket.write_async(buffer, /* use awaitable? */); } ); You see, my async operation is done inside the post callback, so using asio::use_awaitable on the async ..
The problem can be a bit complex. I will try to explain the best possible the situation and what tools I imagined to solve my problems. I am writing a socket application that may write into a socket and expects a response. The protocol enable that in an easy way: each request has a "command ..
I have Client class: Client { std::vector<char> buffer; //actually these are asio socket and waitable_timer but that’s beside the point Socket socket; Timer timer; public: void send_request(std::string req); //sends request in new thread and immediately returns }; If I’m not mistaken, buffer, socket and timer are shared among threads. Now I want socket and buffer ..
I’ve already seen the boost::process tutorial… but there the example is a single write then a single read from the child process. I want to know if it is possible to have both async_pipes alive (read and write) during the child process lifetime. I’m having trouble reading from child->parent pipe (read_pipe, in my code). I ..
I was just trying to accept incoming request with acceptor socket and when it enters the async_accept it throws out an error, I’m not sure what is causing the error. The thing is I’m not even sending the request from the client but still it enters the async_accept handler for some reason, here is the ..
I cannot get boost::asio to work with cmake in my c++ program. I have actually tried and googled for many hours, but I cannot get it to work! I want to include boost::asio in my c++ Project under Ubuntu 18.04 with a cmake file. So I installed the newest CMake (cmake version 3.19.4), and I ..
I am new to c++ and boost library, trying to learn a header file by making three separate files from this example. https://www.boost.org/doc/libs/1_70_0/doc/html/boost_asio/example/cpp11/chat/chat_server.cpp chat_message.hpp is here although I don’t think this causes a problem. https://www.boost.org/doc/libs/1_70_0/doc/html/boost_asio/example/cpp11/chat/chat_message.hpp The goal is to slit the example into three components. main.cpp chat_server.h – header file for declaration chat_server.cpp – implementation ..
Recent Comments