Closed MortezaBashsiz closed 8 months ago
Hi
I want to write a request on socket and read the response from it The part writing to the socket is OK, but the part read is too slow.
boost::system::error_code ec; boost::asio::write(socket, boost::asio::buffer(message), ec); if (ec) { std::cerr << ec.what(); } boost::asio::streambuf responseBuffer; int bytesTransferred = boost::asio::read(socket, responseBuffer, boost::asio::transfer_all(), ec); if (ec && ec != boost::asio::error::eof) { std::cerr << ec.what(); } std::cout << "DEBUG : " << bytesTransferred << std::endl; unsigned char tempData[bytesTransferred]; std::memcpy(tempData, boost::asio::buffer_cast<const void*>(responseBuffer.data()), bytesTransferred);
NOTE: Even with using treansfer_atleast(1) or transfer_exactly(1) in a loop, the result is the same. NOTE: I do not know exact size in read and it could be different
Hi
I want to write a request on socket and read the response from it The part writing to the socket is OK, but the part read is too slow.
NOTE: Even with using treansfer_atleast(1) or transfer_exactly(1) in a loop, the result is the same. NOTE: I do not know exact size in read and it could be different