|
|
| INT
HttpSetPriority(
|
|
|
HCLIENT
hClient, |
|
|
|
|
INT nPriority |
|
|
| );
|
The HttpSetPriority function specifies the priority for
file transfers.
Parameters
- hClient
- Handle to the client session.
- nPriority
- An integer value which specifies the new priority for file
transfers. It may be one of the following values:
| Constant |
Description |
|
HTTP_PRIORITY_NORMAL |
The default priority which balances resource
utilization and transfer speed. It is recommended that most
applications use this priority. |
|
HTTP_PRIORITY_BACKGROUND |
This priority significantly reduces the memory,
processor and network resource utilization for the transfer. It is
typically used with worker threads running in the background when
the amount of time required perform the transfer is not
critical. |
|
HTTP_PRIORITY_LOW |
This priority lowers the overall resource
utilization for the transfer and meters the bandwidth allocated for
the transfer. This priority will increase the average amount of
time required to complete a file transfer. |
|
HTTP_PRIORITY_HIGH |
This priority increases the overall resource
utilization for the transfer, allocating more memory for internal
buffering. It can be used when it is important to transfer the file
quickly, and there are no other threads currently performing file
transfers at the time. |
|
HTTP_PRIORITY_CRITICAL |
This priority can significantly increase
processor, memory and network utilization while attempting to
transfer the file as quickly as possible. If the file transfer is
being performed in the main UI thread, this priority can cause the
application to appear to become non-responsive. No events will be
generated during the transfer. |
Return Value
If the function succeeds, the return value is the previous file
transfer priority. If the function fails, the return value is
HTTP_ERROR. To get extended error information, call
HttpGetLastError.
Remarks
The HttpSetPriority function 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.
Requirements
Client: Requires Windows Vista, Windows XP or Windows
2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or
Windows 2000 Server.
Header: Include cstools6.h.
Library: Use cshtpav6.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
HttpGetPriority
|
|