Communication using Torrents

1

I am programming a small application, which makes P2P communications, similar to a torrent, and I have a theoretical question regarding the trackers. Do the computers use the trackers to know the "little bits" that other computers have ?, or the data on them are broadcast to all other computers, so they know the computer already has the "little bit"?

    
asked by anonymous 13.04.2016 / 06:59

1 answer

2

No, the trackers only say the ip / port and a flag (1 or 0) that indicates whether that host is seed or leech (100% or less of the torrent content). To get the rest of the information, it is necessary to connect to one of the machines that the tracker indicates and request the other information using the BitTorrent protocol.

Take a look at this: link

More precisely in defining this message:

  

bitfield: len = 0001 + X id = 5 bitfield The bitfield message may only be   immediately after the handshaking sequence is completed, and   before any other messages are sent. It is optional, and it need not be   Sent if a client has no pieces.

     

The bitfield message is variable length, where X is the length of the   bitfield. The payload is a bitfield representing the pieces that have   been successfully downloaded. The high bit in the first byte   Bits that are cleared to   missing piece, and set bits indicate to valid and available piece.   Spare bits at the end are set to zero.

     

Some clients (Deluge for example) send bitfield with missing pieces   even if it has all data. Then it sends rest of pieces as have   messages. They are saying this helps against ISP filtering of   BitTorrent protocol. It's called lazy bitfield.

     

A bitfield of the wrong length is considered an error. Clients should   drop the connection if they receive bitfields that are not of the   correct size, or if the bitfield has any of the spare bits set.

I believe that your question has already been answered in the first sentence, but to complement the information, there is a translation (half mouth and well summarized, from the definition of the message I posted above):

  

After negotiating the connection, both peers should send a type   specific message, before any other, containing a bit sequence, which represents the sequence of chunks of the torrent contents. The bits set with 1 represent the pieces that the peer has, and the bits set with 0, the pieces that he does not have. If the peer does not have any parts, it does not need to send this message.

    
13.04.2016 / 07:36