Everything is uploaded and downloaded by chunks. Insert
System.Threading.Thread.Sleep
between then. During the sleep, a thread consumes zero CPU, until waken up by sleep timeout or
System.Threading.Thread.Abort
yielding CPU cores to other threads.
For download, this must be clear (for one reference you can take a look at my application HttpDownloader I provided here at CodeProject:
how to download a file from internet[
^]). For HTTP upload (for example), you use the class
HttpWebRequest
with method "POST". Look at this example:
http://msdn.microsoft.com/en-us/library/debx8sh9.aspx[
^]. Now, locate the line in sample code:
dataStream.Write (byteArray, 0, byteArray.Length);
. If a byte array is big enough, send it in chunks and insert
Sleep
statement in cycle.
—SA