📜 ⬆️ ⬇️

Background Intelligent Transfer Service

You still do not know how best to organize the transfer of files over the network to computers running Windows? Then you here!

Background Intelligent Transfer Service (BITS) is a Windows OS that can transfer files in the background. It is used mainly for Windows Update.

What is the interest of BITS for developers?
')
1. The ability to download files in the background, invisible to the user
2. High level of fault tolerance. If the network cable is cut, or the computer falls into a “blue screen”, then BITS downloads files as soon as it becomes possible.
3. Intelligent said for good reason. If the user is not downloading anything at the moment and the computer is idle, BITS will use the freed resources. This feature can be used by assigning different download priorities.


You can work with BITS through a special API.

In my project, I used a convenient, quite working “wrapper” for .NET . There is also one more .

The key object of BITS is Job (no literal translation is necessary, let's call it “download”).
The life cycle of "download" is as follows:

1. Creating a job. Specify the name, description, type (Upload \ Download) and priority

2. Adding files. Job can contain multiple files if the Download type is selected.

3. Subscribe to download events, if you need to track progress in real time.

4. Start the download. Then BITS does everything himself.

An important feature of BITS is that only a user who logs in to the system or a system account can create a download. Those who are going to use BITS, I advise you not to forget about it.

I deliberately do not cite examples of code, they are here and here .

For more information there is a great article in English .

Source: https://habr.com/ru/post/127536/


All Articles