BITS CONTROLS Sample
Summary
This sample
demonstrates the usage of BITS APIs to control and configure BITS options.
Program flow
CONTORL.cpp
builds on the concepts established in the DOWNLOADS.cpp example, it is
recommended that you review DOWNLOADS.cpp prior to reviewing this sample – it
will aid understanding of the program flow.
The key
difference between the two samples is the use of BITS APIs to enable peer
caching and to set a minimum size for a cache on the test machine (to act as
server to other peers).
Key Concepts
- Basic
connection with BITS job manager and submission of BITS jobs
- Adding
a file to the job
- Registration
of a job callback for special handling of errors and job states
- Submission
of CONTROL job
- Processing
notifications on completion.
- Use
of BITS IBackgroundCopyManager
- Use
of BITS IBackgroundCopyJob(n)
- Use
of BITS IBitsPeerCacheAdministration
Build/Configuration instructions
- Run
"VCBuild CONTROL" in the directory
where the sources are. Or, use Visual Studio to build the job. Optionally,
the binaries are provided.
- Execute
CONTROL.exe.
Basic Usage
- Select
a file on a remote computer that your test machine has access to.
- Select
a location and name for the downloaded file to occupy on the test machine.
- Enter
the command CONTROL.exe <RemoteName> <LocalName>
- When
the CONTROL completes or fails, you will be notified.
- Use
the command: bitsadmin /cache /list /verbose to
see what files are held in your test machines cache to service other
peers.
System configuration
- To
be able to compile the samples, the Windows Vista SDK must be installed.
- The
sample code requires BITS 3.0 which is available as part of Windows Vista,
or Windows Server 2008.