Given that the length field of an IP packet is 2 bytes, no. Your stream will be broken into packets of at most 65k. But since TCP is a stream protocol it is up to the implementation how the packets are formatted and sent. You are only guaranteed to get the data you sent in the order you sent it.
If you want to know where the end of your sent data is, consider sending the data size first then reading that amount of data.
unsigned int len = vect.size();
iResult = send( ConnectSocket, &len, sizeof(len), 0 ); // Sending The Length
iResult = send( ConnectSocket, &vect[0], vect.size(), 0 ); // Sending The File
Then on the receiving side:
unsigned int len;
iResult = recv(socket, &len, sizeof(len), 0);
// now you know how much data to read to get your png
Also note, you should check how much is sent during each call to send
since it does not have to send the entire buffer in a single call. Same with recv
. You may have to call recv
multiple times to read the entire sent data.