I have a c++ client that sends a large string (Minimum size 10 KB) to a Java server application after a certain interval. During that interval the c++ application accumulates huge bytes of data and sends it completely to server.The server also receives it at one shot.
I want to keep the size of the string variable less than string::max_size at all times. Once the string's size approaches the limit I will then send that string to server and clear the string and only then move on collecting the remaining data.
and if the string can hold the complete data , will the entire data be transferred from client to server without fail.(Assuming no connection reset or any other such problem arises.)
Can somebody tell me If this is the way to proceed?
the client wouldn't know how big is the string, and it wouldn't know when to stop listening and start processing the received string.
You need to send the size of the string as an int, then send the data over. When the server has received all the data, it will know that the string has been received correctly.