1.What happens if fstream::read() hits eof before reading enough characters of length field?
2.How can I tell how many characters have been read in this case?
Thanks
while(in_file.read(buffer, buffer_length)){//what happens if eof not at the end of size buffer_lenth
temp = sendto(sender_socket, buffer, sizeof(buffer), 0, NULL, 0);
byte_count += temp;
msg_count ++;
}
What I'm trying to do here is read in fixed length of a file and send to sender_socket however for the last message the buffer is most likely unfilled, instead of sizeof(buffer) how do I determine the size I'm sending. The files will be in binary form.
Aucun commentaire:
Enregistrer un commentaire