⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bittorrentspecification.htm

📁 关于BT的协议文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<li class="toclevel-2"><a href="#Overview"><span class="tocnumber">10.1</span> <span class="toctext">Overview</span></a></li><li class="toclevel-2"><a href="#Data_Types"><span class="tocnumber">10.2</span> <span class="toctext">Data Types</span></a></li><li class="toclevel-2"><a href="#Message_flow"><span class="tocnumber">10.3</span> <span class="toctext">Message flow</span></a></li><li class="toclevel-2"><a href="#Handshake"><span class="tocnumber">10.4</span> <span class="toctext">Handshake</span></a><ul><li class="toclevel-3"><a href="#peer_id"><span class="tocnumber">10.4.1</span> <span class="toctext">peer_id</span></a></li></ul></li><li class="toclevel-2"><a href="#Messages"><span class="tocnumber">10.5</span> <span class="toctext">Messages</span></a><ul><li class="toclevel-3"><a href="#keep-alive:_.3Clen.3D0000.3E"><span class="tocnumber">10.5.1</span> <span class="toctext">keep-alive: &lt;len=0000&gt;</span></a></li><li class="toclevel-3"><a href="#choke:_.3Clen.3D0001.3E.3Cid.3D0.3E"><span class="tocnumber">10.5.2</span> <span class="toctext">choke: &lt;len=0001&gt;&lt;id=0&gt;</span></a></li><li class="toclevel-3"><a href="#unchoke:_.3Clen.3D0001.3E.3Cid.3D1.3E"><span class="tocnumber">10.5.3</span> <span class="toctext">unchoke: &lt;len=0001&gt;&lt;id=1&gt;</span></a></li><li class="toclevel-3"><a href="#interested:_.3Clen.3D0001.3E.3Cid.3D2.3E"><span class="tocnumber">10.5.4</span> <span class="toctext">interested: &lt;len=0001&gt;&lt;id=2&gt;</span></a></li><li class="toclevel-3"><a href="#not_interested:_.3Clen.3D0001.3E.3Cid.3D3.3E"><span class="tocnumber">10.5.5</span> <span class="toctext">not interested: &lt;len=0001&gt;&lt;id=3&gt;</span></a></li><li class="toclevel-3"><a href="#have:_.3Clen.3D0005.3E.3Cid.3D4.3E.3Cpiece_index.3E"><span class="tocnumber">10.5.6</span> <span class="toctext">have: &lt;len=0005&gt;&lt;id=4&gt;&lt;piece index&gt;</span></a></li><li class="toclevel-3"><a href="#bitfield:_.3Clen.3D0001.2BX.3E.3Cid.3D5.3E.3Cbitfield.3E"><span class="tocnumber">10.5.7</span> <span class="toctext">bitfield: &lt;len=0001+X&gt;&lt;id=5&gt;&lt;bitfield&gt;</span></a></li><li class="toclevel-3"><a href="#request:_.3Clen.3D0013.3E.3Cid.3D6.3E.3Cindex.3E.3Cbegin.3E.3Clength.3E"><span class="tocnumber">10.5.8</span> <span class="toctext">request: &lt;len=0013&gt;&lt;id=6&gt;&lt;index&gt;&lt;begin&gt;&lt;length&gt;</span></a></li><li class="toclevel-3"><a href="#piece:_.3Clen.3D0009.2BX.3E.3Cid.3D7.3E.3Cindex.3E.3Cbegin.3E.3Cblock.3E"><span class="tocnumber">10.5.9</span> <span class="toctext">piece: &lt;len=0009+X&gt;&lt;id=7&gt;&lt;index&gt;&lt;begin&gt;&lt;block&gt;</span></a></li><li class="toclevel-3"><a href="#cancel:_.3Clen.3D0013.3E.3Cid.3C.3D8.3E.3Cindex.3E.3Cbegin.3E.3Clength.3E"><span class="tocnumber">10.5.10</span> <span class="toctext">cancel: &lt;len=0013&gt;&lt;id&lt;=8&gt;&lt;index&gt;&lt;begin&gt;&lt;length&gt;</span></a></li><li class="toclevel-3"><a href="#port:_.3Clen.3D0003.3E.3Cid.3D9.3E.3Clisten-port.3E"><span class="tocnumber">10.5.11</span> <span class="toctext">port: &lt;len=0003&gt;&lt;id=9&gt;&lt;listen-port&gt;</span></a></li></ul></li></ul></li><li class="toclevel-1"><a href="#Algorithms"><span class="tocnumber">11</span> <span class="toctext">Algorithms</span></a><ul><li class="toclevel-2"><a href="#Queuing"><span class="tocnumber">11.1</span> <span class="toctext">Queuing</span></a></li><li class="toclevel-2"><a href="#Super_Seeding"><span class="tocnumber">11.2</span> <span class="toctext">Super Seeding</span></a></li><li class="toclevel-2"><a href="#Piece_downloading_strategy"><span class="tocnumber">11.3</span> <span class="toctext">Piece downloading strategy</span></a></li><li class="toclevel-2"><a href="#End_Game"><span class="tocnumber">11.4</span> <span class="toctext">End Game</span></a></li><li class="toclevel-2"><a href="#Choking_and_Optimistic_Unchoking"><span class="tocnumber">11.5</span> <span class="toctext">Choking and Optimistic Unchoking</span></a><ul><li class="toclevel-3"><a href="#Anti-snubbing"><span class="tocnumber">11.5.1</span> <span class="toctext">Anti-snubbing</span></a></li></ul></li></ul></li><li class="toclevel-1"><a href="#Official_Extensions_To_The_Protocol"><span class="tocnumber">12</span> <span class="toctext">Official Extensions To The Protocol</span></a><ul><li class="toclevel-2"><a href="#Fast_Peers_Extensions"><span class="tocnumber">12.1</span> <span class="toctext">Fast Peers Extensions</span></a></li><li class="toclevel-2"><a href="#Distributed_Hash_Table"><span class="tocnumber">12.2</span> <span class="toctext">Distributed Hash Table</span></a></li><li class="toclevel-2"><a href="#Connection_Encryption"><span class="tocnumber">12.3</span> <span class="toctext">Connection Encryption</span></a></li></ul></li><li class="toclevel-1"><a href="#Unofficial_Extensions_To_The_Protocol"><span class="tocnumber">13</span> <span class="toctext">Unofficial Extensions To The Protocol</span></a><ul><li class="toclevel-2"><a href="#WebSeeding"><span class="tocnumber">13.1</span> <span class="toctext">WebSeeding</span></a></li><li class="toclevel-2"><a href="#Extension_protocol"><span class="tocnumber">13.2</span> <span class="toctext">Extension protocol</span></a></li></ul></li><li class="toclevel-1"><a href="#Reserved_Bytes"><span class="tocnumber">14</span> <span class="toctext">Reserved Bytes</span></a></li><li class="toclevel-1"><a href="#Change_Log"><span class="tocnumber">15</span> <span class="toctext">Change Log</span></a></li></ul></td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=1" title="Edit section: Identification">edit</a>]</div><a name="Identification"></a><h2> Identification </h2><p><a href="/BitTorrent" title="BitTorrent">BitTorrent</a> is a peer-to-peer file sharing protocol designed by Bram Cohen.  Visit his pages at <a href="http://www.bittorrent.com" class="external free" title="http://www.bittorrent.com" rel="nofollow">http://www.bittorrent.com</a> BitTorrent is designed to facilitate file transfers among multiple peers across unreliable networks.</p><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=2" title="Edit section: Purpose">edit</a>]</div><a name="Purpose"></a><h2> Purpose </h2><p>The purpose of this specification is to document version 1.0 of the BitTorrent protocol specification in detail.  Bram's  <a href="http://www.bittorrent.org/protocol.html" class="external text" title="http://www.bittorrent.org/protocol.html" rel="nofollow">protocol specification page</a> outlines the protocol in somewhat general terms, and lacks behaviorial detail in some areas.  The hope is that this document will become a <b>formal</b> specification, written in clear, unambiguous terms, which can be used as a basis for discussion and implementation in the future.</p><p>This document is intended to be maintained and used by the BitTorrent development community.  Everyone is invited to contribute to this document, with the understanding that the content here is intended to represent the current protocol, which is already deployed in a number of existing client implementations.</p><p>This is not the place to suggest feature requests.  For that, please go to the <a href="http://lists.ibiblio.org/mailman/listinfo/bittorrent" class="external text" title="http://lists.ibiblio.org/mailman/listinfo/bittorrent" rel="nofollow">mailing list</a>.</p><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=3" title="Edit section: Scope">edit</a>]</div><a name="Scope"></a><h2> Scope </h2><p>This document applies to the first version (i.e. version 1.0) of the BitTorrent protocol specification. Currently, this applies to the torrent file structure, peer wire protocol, and the Tracker HTTP/HTTPS protocol specifications. As newer revisions of each protocol are defined, they should be specified on their own separate pages, <b>not here</b>.</p><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=4" title="Edit section: Related Documents">edit</a>]</div><a name="Related_Documents"></a><h2> Related Documents </h2><ul><li> <a href="http://www.bittorrent.org/protocol.html" class="external free" title="http://www.bittorrent.org/protocol.html" rel="nofollow">http://www.bittorrent.org/protocol.html</a> - The official protocol specification.</li><li> <a href="/BitTorrentWishList" title="BitTorrentWishList">BitTorrentWishList</a> - A wish list for developers and end users alike.</li><li> <a href="/BitTorrentTrackerExtensions" title="BitTorrentTrackerExtensions">BitTorrentTrackerExtensions</a> - Describes the various extensions of the Tracker protocol that are in use.</li></ul><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=5" title="Edit section: Conventions">edit</a>]</div><a name="Conventions"></a><h2> Conventions </h2><p>In this document, a number of conventions are used in an attempt to present information in a concise and unambiguous fashion.</p><ul><li> <i>peer</i> v/s <i>client</i>: In this document, a <i>peer</i> is any BitTorrent client participating in a download.  The <i>client</i> is also a peer, however it is the BitTorrent client that is running on the local machine.  Readers of this specification may choose to think of themselves as the <i>client</i> which connects to numerous <i>peers</i>.</li><li> <i>piece</i> v/s <i>block</i>: In this document, a <i>piece</i> refers to a portion of the downloaded data that is described in the metainfo file, which can be verified by a SHA1 hash.  A <i>block</i> is a portion of data that a <i>client</i> may request from a <i>peer</i>.  Two or more <i>blocks</i> make up a whole <i>piece</i>, which may then be verified.</li><li> <i>defacto standard</i>: Large blocks of text in <i>italics</i> indicates a practice so common in various client implementations of BitTorrent that it is considered a defacto standard.</li></ul><p>In order to help others find recent changes that have been made to this document, please fill out the change log (last section).  This should contain a brief (i.e. one-line) entry for each major change that you've made to the document.</p><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=6" title="Edit section: bencoding">edit</a>]</div><a name="bencoding"></a><h2> bencoding </h2><p>Bencoding is a way to specify and organize data in a terse format.  It supports the following types: byte strings, integers, lists, and dictionaries.</p><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=7" title="Edit section: byte strings">edit</a>]</div><a name="byte_strings"></a><h3> byte strings </h3><p>Byte strings are encoded as follows: <i>&lt;string length encoded in base ten ASCII&gt;<b>:</b>&lt;string data&gt;</i><br />Note that there is no constant beginning delimiter, and no ending delimiter.</p><dl><dd><b>Example</b>: <i>4<b>:</b>spam</i> represents the string "spam"</dd></dl><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=8" title="Edit section: integers">edit</a>]</div><a name="integers"></a><h3> integers </h3><p>Integers are encoded as follows: <i><b>i</b>&lt;integer encoded in base ten ASCII&gt;<b>e</b></i><br />The initial <b>i</b> and trailing <b>e</b> are beginning and ending delimiters. You can have negative numbers such as <i><b>i</b>-3<b>e</b></i>. You cannot prefix the number with a zero such as <i><b>i</b>04<b>e</b></i>.  However, <i><b>i</b>0<b>e</b></i> is valid.</p><dl><dd><b>Example</b>: <i><b>i</b>3<b>e</b></i> represents the integer "3"</dd></dl><ul><li> <i>NOTE:</i> The maximum number of bit of this integer is unspecified, but to handle it as a signed 64bit integer is mandatory to handle "large files" aka .torrent for more that 4Gbyte</li></ul><div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=BitTorrentSpecification&amp;action=edit&amp;section=9" title="Edit section: lists">edit</a>]</div><a name="lists"></a><h3> lists </h3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -