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:

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:

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.