asynch_write fails when used to write long data

Hi, I have a Client (windows) - server (linux) program which uses boost::asio asynch methods. I am getting error when server writes to client using asynch_write and data is large with size greater than a particular value. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// std::vectorboost::asio::const_buffer _buffers; _buffers.push_back(boost::asio::buffer(outbound_header)); _buffers.push_back(boost::asio::buffer(outbound_message)); _buffers.push_back(boost::asio::buffer(outbound_data)); boost::asio::async_write(_socket, _buffers, boost::bind(&ClientSession::handle_write, this, boost::asio::placeholders::error)); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// here outbound_header is of type string of length 8 and has value " 202e5" outbound_message is of type string of length 8 and has value " 2" outbound_data when of length 131813. I get error with error_code - val = 14 (Bad Address) If I reduce the outbound_data size to 130812, everything is fine. I am unable to figure out the problem, I thought I can send unlimited size data in a single call. Please advise if you have any idea. I will be more than happy to provide you with information that you may need. Regards, Anil Agrawal PTS

I am getting error when server writes to client using asynch_write and data is large with size greater than a particular value. ... outbound_data when of length 131813. I get error with error_code - val = 14 (Bad Address)
I believe that error 14 / bad address means you're pointing to bad memory address - are you sure the memory is good? Are you using shared_ptr to manage the buffer lifetime? (It's hard to manage the memory lifetime otherwise.) The bigger size triggering the error may only mean that the bug doesn't show up until a certain threshold is reached. Cliff
participants (2)
-
A.Agrawal@patrick.com.au
-
Cliff Green