The SetPriority method can be used to control the processor
usage, memory and network bandwidth allocated for file transfers. The
default priority balances resource utilization and transfer speed
while ensuring that a single-threaded application remains responsive
to the user. Lower priorities reduce the overall resource utilization
at the expense of transfer speed. For example, if you create a worker
thread to download a file in the background and want to ensure that
it has a minimal impact on the process, the HTTP_PRIORITY_BACKGROUND
value can be used.
Higher priority values increase the memory allocated for the
transfers and increases processor utilization for the transfer. The
HTTP_PRIORITY_CRITICAL priority maximizes transfer speed at the
expense of system resources. It is not recommended that you increase
the file transfer priority unless you understand the implications of
doing so and have thoroughly tested your application.
If the file transfer is being performed in the main UI thread,
increasing the priority may interfere with the normal processing of
Windows messages and cause the application to appear to become
non-responsive. It is also important to note that when the priority
is set to HTTP_PRIORITY_CRITICAL, normal progress events will not
be generated during the transfer.