I am developing a C ++ application and am having difficulty with socket support. The server sends the image, but not all bytes are accepted by the client; the client always receives 500 bytes less than the sent server. Below is the corresponding code and screenshots of the program.
Server Code:
int sent = boost::asio::write(*socket, response, boost::asio::transfer_all(), error); std::cout << "Sent: " << sent << std ::endl;
Client code (I know that read_some will block if the shared bytes sent by the server are divided by 10000, this code is for testing only):
int len = 0; int count = 0; do { len = socket->read_some( boost::asio::buffer( imageData, 10000 ) ); count += len; std::cout << "len: " << len << std::endl; std::cout << "count: " << count << std::endl; } while(len == 10000); std::cout << "Image Received of size: " << count << std::endl;
Screenshot from server: 
Client Screenshot: 
Thank you for your time; Any help or suggestions would be greatly appreciated.
source share