Communication using Torrents

Asked

Viewed 70 times

1

I am programming a small application, which does P2P communications, similar to a torrent, and I came up with a theoretical question regarding trackers. Do computers use trackers to know what "little pieces" other computers have? , or the data on them are broadcast to all other computers, so that they realize that the computer already has the "little piece"?.

  • The trackers are basically to change the list of pairs that has that hash. The hash is the result of the contents of the torrent. The pieces are traded between the pairs (and their individually checked hashes, to avoid data corruption). Broadcast does not come to the case for torrents. By the way, the use of broadcast in internet is very limited, the most normal is in local networks. On the Internet you simply cannot go out doing broadcast, even for the sake of "sanity" of the network (unless we are talking about broadcast generically). Not to be confused with DHT, which is a distribution service.

1 answer

2


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

Take a look at this: https://wiki.theory.org/BitTorrentSpecification#Messages

More precisely in defining this message:

bitfield: Len=0001+X id=5 bitfield The bitfield message may only be sent immediately after the handshaking Quence is completed, and before any other messages are sent. It is optional, and 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 Corresponds to Piece index 0. Bits that are cleared indicated a Missing Piece, and set bits indicate a 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 is 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 your question has already been answered in the first sentence, but to complement the information, follow a translation (half-mouth and well summarized, the definition of the message I posted above):

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.