I read official documetation here and wikipedia article about bittorrent client here but couldn't find how tracker exactly work. As per my understanding tracker should know which peer have which piece of some file. For example client 1 have 5 pieces of file 1 and 10 pieces of file 2. In official documentation I see tracker have fields like peer_id
ip
port
uploaded
downloaded
left
and event
but I don't see where is the information about which file we are tracking. For example if I ask tracker hey I need pieces for linux.torrent file, how tracker would answer me?
-
Unless you have a question about programming your own tracker or patching someone else's, this is not on-topic for SO and would be better suited to SuperUser.– underscore_dNov 16, 2017 at 13:49
-
I am trying to implement my own java based tracker, client etc. so I need information which fields I need in tracker and how client know which peers have pieces that it is interested for. I guess it should ask a tracker but I don't know how.– Spasoje PetronijevićNov 16, 2017 at 13:52
Add a comment
|
2 Answers
A trackers job is, when a peer announces to a specific swarm (identified by the info_hash
),to register that peer as active on that swarm and then send that peer a peer list with other peers active on that swarm.
A tracker does NOT keep track on which pieces or files a peer has.
I recommend you to read the inoffical protocol specification: https://wiki.theory.org/index.php/BitTorrentSpecification
it's bit easier do comprehend than the terse and dense BEP-3.
-
To make the answer even more helpful @Encombe, could you include what is a "swarm"? What is the exact difference between
keep track on which pieces or files a peer has.
(you said it doesn't) and a list of peersactive on that swarm and then send that peer a peer list with other peers active on that swarm.
?– BasjJan 13, 2018 at 17:41 -