How does the Bittorrent protocol handle the data chunks?

痴心易碎 提交于 2019-12-07 12:06:43

问题


How are the data chunks handled within the bittorrent protocol?

When a client wants to download e.g. a linux distribution does the tracker return a list of peers which a client then connects to and requests chunks from each peer or does the tracker return a list of peers and info of which peer has what data?

Where is the data chunks managed or handled e.g. I need chunk 5 , 6, 10 and peer 2 has chunk 5, 7, 8. where is the data controlled or managed? Does the client request chunks from the other peers then the peer checks if it has the chunk and then sends it or how does the data flow work?

Thanks


回答1:


The tracker provides the list of peers, then the peers connect and swap lists of chunks.

The peers exchange a BITFIELD message immediately after the initial handshake. The BITFIELD contains 1s for pieces the peer has and 0s for those it doesn’t have. When a peer receives the BITFIELD, if all the bits are set to 1, then the remote peer is a seed. This way peers can identify seeds easily.

(from http://web.archive.org/web/20041119150847/http://mnl.cs.stonybrook.edu/home/karthik/BitTorrent/Robustness_of_BT.doc)



来源:https://stackoverflow.com/questions/3941199/how-does-the-bittorrent-protocol-handle-the-data-chunks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!