I'm trying to create a simple file upload using boost::asio and ajax. Somehow the bytes_transferred reaches a maximum at 21845 (or something like that) even though my buffer size is 500MB. With text files std::cout displays something but with binary files it cuts off right after the header (still 21845 bytes are transferred).
I tried using different methods like async_read_some and async_read_until but it didn't change anything. Also tried socket.set_option() with keep-alive and changing socket buffer size.
class tcp_connection
{
public:
void start() {
boost::asio::async_read(socket, boost::asio::buffer(buf), boost::asio::transfer_at_least(1), boost::bind(&tcp_connection::handler, error, bytes_transferred));
}
private:
boost::array<unsigned char, 500000000> buf;
void handler(error, bytes) {
std::cout << buf.data() << std::endl;
boost::asio::async_write(socket, response_buffer, boost::bind(&tcp_connection, handler));
}
}
Please look at https://pastebin.com/dPvVGsjU for the full minimal-reproductible example
I don't receive error messages, although I am ignoring eof errors.