How Torrent Clients Report Bytes to Trackers
BitTorrent clients continuously update trackers regarding their transfer progress using periodic messages called “announces.” Through these requests, the client reports key metrics, specifically the total bytes uploaded, downloaded, and the number of bytes left to complete the file. This communication allows the tracker to maintain swarm statistics, calculate user sharing ratios on private trackers, and provide peer lists to participating clients.
The Announce Request
When a BitTorrent client communicates with a tracker, it sends an announce request over HTTP, HTTPS, or UDP. This message is sent when a torrent is started, stopped, completed, or at regular intervals defined by the tracker (typically every 30 to 60 minutes).
Core Parameters Sent by the Client
The client includes three primary numerical values in the announce request payload:
uploaded: A 64-bit integer representing the total number of bytes the client has sent to other peers for this specific torrent since the client began transferring.downloaded: A 64-bit integer representing the total number of verified, non-corrupted payload bytes the client has received from peers. This generally does not include protocol overhead or discarded corrupted data.left: A 64-bit integer indicating the exact number of bytes the client still needs to download to achieve 100% completion. If a client is acting purely as a seeder, this value is sent as0.
HTTP/HTTPS Announce Protocol
In the standard HTTP/HTTPS tracker protocol (BEP 3), these metrics
are passed as query parameters within a standard GET
request.
A simplified announce request URL looks like this:
https://tracker.example.com/announce?info_hash=%xx%xx...&peer_id=-UT3530-...&port=6881&uploaded=104857600&downloaded=524288000&left=1048576000&event=started
In this example: * uploaded=104857600 reports 100 MB
uploaded. * downloaded=524288000 reports 500 MB downloaded.
* left=1048576000 reports 1 GB remaining. *
event specifies the state change (started,
stopped, completed, or omitted if it is a
regular interval announce).
UDP Announce Protocol
Because HTTP requests create significant server overhead, modern swarms commonly use the UDP Tracker Protocol (BEP 15). Under this binary protocol, reporting works identically in function but transmits raw binary data instead of text parameters:
- Offset 32–39: 64-bit integer for
downloaded - Offset 40–47: 64-bit integer for
left - Offset 48–55: 64-bit integer for
uploaded
How the Tracker Calculates Deltas
The client always reports cumulative values for the current session, not the amount transferred since the last individual announce. To track live bandwidth or update user accounts, the tracker compares the current announce numbers with the previous record stored in its database:
\[\text{Delta Upload} = \text{Current Uploaded} - \text{Previous Uploaded}\]
By dividing this delta by the time elapsed between announces, the tracker can also determine the client’s average transfer speed.