I want to send a file in chunks by calling a function that calls a webservice using multithreading.
The following is a brief of the code:
int chunkSize = "whatever in byte";
byte[] fileBytes = ConvFileToByte("the pathe of the file");
int numberOfParts = (int)Math.Ceiling((decimal)fileSize / chunkSize);
for (int i; i< numberOfParts; i++)
{
//Get the offset.
//Get the bytes to send.
SendFile(ByteToSend, offset) // This call a method in a webservice.
}
What is the best way to use mutithreading in this function?
Note: but don't forget that if one chunk failed to send I should send it again.