Iam tring to send a file using a socket, but almost always it cuts the file over the transmission, but the socket never sends an exception, it just does not send all the file.
Trying to solve this im sending the lenght of the file as a header to the server, so it could validate if the file is complete, if not it send a signal back asking for retransmition.
This works, but some times it takes up to 250 tries to get the file well, ¿what do you thinks is happening?, I have in mind sending the file in smaller chunks, but what is a good size for the chunk?,
The files that fails to be send are of a size of 80kb, and some times even a file of 20kb fails!.
any tips?
After sending the file data, you can use the Flush() method to force sending of all local buffered data.
When sending, TCP breaks the data up into small packets.
When reading data, the Read() method returns an integer which is the number of bytes actually read.
Always make sure that the amount you intended to read is the amount that was read.