/_SolutionItems_/Documents/BitTorrentSpecification - TheoryOrg.mht
Unknown | 6548 lines | 6497 code | 51 blank | 0 comment | 0 complexity | 3e35ac6feb90327a6c4170a32cd0a36c MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- From: "Saved by Windows Internet Explorer 9"
- Subject: BitTorrentSpecification - TheoryOrg
- Date: Thu, 8 Sep 2011 06:20:06 +0800
- MIME-Version: 1.0
- Content-Type: multipart/related;
- type="text/html";
- boundary="----=_NextPart_000_0000_01CC6DEF.5A1D4220"
- X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.17609
-
- This is a multi-part message in MIME format.
-
- ------=_NextPart_000_0000_01CC6DEF.5A1D4220
- Content-Type: text/html;
- charset="utf-8"
- Content-Transfer-Encoding: quoted-printable
- Content-Location: http://wiki.theory.org/BitTorrentSpecification
-
- =EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" =
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><HTML=20
- dir=3D"ltr" lang=3D"en"><HEAD><TITLE>BitTorrentSpecification - =
- TheoryOrg</TITLE>
- <META content=3D"text/html; charset=3Dutf-8" =
- http-equiv=3D"Content-Type">
- <META name=3D"GENERATOR" content=3D"MSHTML 9.00.8112.16434"><LINK =
- rel=3D"shortcut icon"=20
- href=3D"/favicon.ico"><LINK title=3D"TheoryOrg (en)" rel=3D"search" =
- type=3D"application/opensearchdescription+xml"=20
- href=3D"/opensearch_desc.php"><LINK title=3D"Creative Commons" =
- rel=3D"meta" type=3D"application/rdf+xml"=20
- href=3D"/index.php?title=3DBitTorrentSpecification&action=3Dcreativec=
- ommons"><LINK=20
- rel=3D"copyright" =
- href=3D"http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt">
- <LINK title=3D"TheoryOrg Atom feed" rel=3D"alternate" =
- type=3D"application/atom+xml"=20
- href=3D"/index.php?title=3DSpecial:RecentChanges&feed=3Datom"><LINK =
- rel=3D"stylesheet"=20
- href=3D"http://wiki.theory.org/skins/common/shared.css?270" =
- media=3D"screen"><LINK=20
- rel=3D"stylesheet" =
- href=3D"http://wiki.theory.org/skins/common/commonPrint.css?270"=20
- media=3D"print"><LINK rel=3D"stylesheet" =
- href=3D"http://wiki.theory.org/skins/monobook/main.css?270"=20
- media=3D"screen"><!--[if lt IE 5.5000]><link rel=3D"stylesheet" =
- href=3D"/skins/monobook/IE50Fixes.css?270" media=3D"screen" =
- /><![endif]--><!--[if IE 5.5000]><link rel=3D"stylesheet" =
- href=3D"/skins/monobook/IE55Fixes.css?270" media=3D"screen" =
- /><![endif]--><!--[if IE 6]><link rel=3D"stylesheet" =
- href=3D"/skins/monobook/IE60Fixes.css?270" media=3D"screen" =
- /><![endif]--><!--[if IE 7]><link rel=3D"stylesheet" =
- href=3D"/skins/monobook/IE70Fixes.css?270" media=3D"screen" =
- /><![endif]-->
- <LINK rel=3D"stylesheet" =
- href=3D"/index.php?title=3DMediaWiki:Common.css&usemsgcache=3Dyes&=
- ;ctype=3Dtext%2Fcss&smaxage=3D18000&action=3Draw&maxage=3D180=
- 00">
- <LINK rel=3D"stylesheet" =
- href=3D"/index.php?title=3DMediaWiki:Print.css&usemsgcache=3Dyes&=
- ctype=3Dtext%2Fcss&smaxage=3D18000&action=3Draw&maxage=3D1800=
- 0"=20
- media=3D"print"><LINK rel=3D"stylesheet" =
- href=3D"/index.php?title=3DMediaWiki:Monobook.css&usemsgcache=3Dyes&a=
- mp;ctype=3Dtext%2Fcss&smaxage=3D18000&action=3Draw&maxage=3D1=
- 8000">
- <LINK rel=3D"stylesheet" =
- href=3D"http://wiki.theory.org/index.php?title=3D-&action=3Draw&m=
- axage=3D18000&gen=3Dcss">
- <SCRIPT>=0A=
- var skin=3D"monobook",=0A=
- stylepath=3D"/skins",=0A=
- wgUrlProtocols=3D"http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/|=
- gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto\\=
- :|news\\:|svn\\:\\/\\/",=0A=
- wgArticlePath=3D"/$1",=0A=
- wgScriptPath=3D"",=0A=
- wgScriptExtension=3D".php",=0A=
- wgScript=3D"/index.php",=0A=
- wgVariantArticlePath=3Dfalse,=0A=
- wgActionPaths=3D{},=0A=
- wgServer=3D"http://wiki.theory.org",=0A=
- wgCanonicalNamespace=3D"",=0A=
- wgCanonicalSpecialPageName=3Dfalse,=0A=
- wgNamespaceNumber=3D0,=0A=
- wgPageName=3D"BitTorrentSpecification",=0A=
- wgTitle=3D"BitTorrentSpecification",=0A=
- wgAction=3D"view",=0A=
- wgArticleId=3D1427,=0A=
- wgIsArticle=3Dtrue,=0A=
- wgUserName=3Dnull,=0A=
- wgUserGroups=3Dnull,=0A=
- wgUserLanguage=3D"en",=0A=
- wgContentLanguage=3D"en",=0A=
- wgBreakFrames=3Dfalse,=0A=
- wgCurRevisionId=3D4218,=0A=
- wgVersion=3D"1.16.5",=0A=
- wgEnableAPI=3Dtrue,=0A=
- wgEnableWriteAPI=3Dtrue,=0A=
- wgSeparatorTransformTable=3D["", ""],=0A=
- wgDigitTransformTable=3D["", ""],=0A=
- wgMainPageTitle=3D"Main Page",=0A=
- wgFormattedNamespaces=3D{"-2": "Media", "-1": "Special", "0": "", "1": =
- "Talk", "2": "User", "3": "User talk", "4": "TheoryOrg", "5": "TheoryOrg =
- talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki =
- talk", "10": "Template", "11": "Template talk", "12": "Help", "13": =
- "Help talk", "14": "Category", "15": "Category talk"},=0A=
- wgNamespaceIds=3D{"media": -2, "special": -1, "": 0, "talk": 1, "user": =
- 2, "user_talk": 3, "theoryorg": 4, "theoryorg_talk": 5, "file": 6, =
- "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, =
- "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, =
- "category_talk": 15, "image": 6, "image_talk": 7},=0A=
- wgSiteName=3D"TheoryOrg",=0A=
- wgCategories=3D["PhpWiki"],=0A=
- wgRestrictionEdit=3D[],=0A=
- wgRestrictionMove=3D[];=0A=
- </SCRIPT>
-
- <SCRIPT =
- src=3D"http://wiki.theory.org/skins/common/wikibits.js?270"></SCRIPT>
-
- <SCRIPT =
- src=3D"http://wiki.theory.org/skins/common/ajax.js?270"></SCRIPT>
-
- <SCRIPT =
- src=3D"http://wiki.theory.org/index.php?title=3D-&action=3Draw&ge=
- n=3Djs&useskin=3Dmonobook&270"></SCRIPT>
- </HEAD>
- <BODY class=3D"mediawiki ltr ns-0 ns-subject =
- page-BitTorrentSpecification skin-monobook">
- <DIV id=3D"globalWrapper">
- <DIV id=3D"column-content">
- <DIV id=3D"content"><A id=3D"top"></A>
- <H1 id=3D"firstHeading" =
- class=3D"firstHeading">BitTorrentSpecification</H1>
- <DIV id=3D"bodyContent">
- <H3 id=3D"siteSub">From TheoryOrg</H3>
- <DIV id=3D"contentSub"></DIV>
- <DIV id=3D"jump-to-nav">Jump to: <A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#column-one">naviga=
- tion</A>,=20
- <A=20
- href=3D"http://wiki.theory.org/BitTorrentSpecification#searchInput">searc=
- h</A></DIV><!-- start content -->
- <P><BIG><BIG><BIG> <I><B>Bittorrent Protocol Specification v1.0</B></I>=20
- </BIG></BIG></BIG></P>
- <TABLE id=3D"toc" class=3D"toc">
- <TBODY>
- <TR>
- <TD>
- <DIV id=3D"toctitle">
- <H2>Contents</H2></DIV>
- <UL>
- <LI class=3D"toclevel-1 tocsection-1"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Identification"><S=
- PAN=20
- class=3D"tocnumber">1</SPAN> <SPAN=20
- class=3D"toctext">Identification</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-2"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Purpose"><SPAN=20
- class=3D"tocnumber">2</SPAN> <SPAN =
- class=3D"toctext">Purpose</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-3"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Scope"><SPAN=20
- class=3D"tocnumber">3</SPAN> <SPAN =
- class=3D"toctext">Scope</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-4"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Related_Documents"=
- ><SPAN=20
- class=3D"tocnumber">4</SPAN> <SPAN class=3D"toctext">Related=20
- Documents</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-5"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Conventions"><SPAN=
- =20
- class=3D"tocnumber">5</SPAN> <SPAN=20
- class=3D"toctext">Conventions</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-6"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Bencoding"><SPAN=20
- class=3D"tocnumber">6</SPAN> <SPAN =
- class=3D"toctext">Bencoding</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-7"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Bencoded_Strings">=
- <SPAN=20
- class=3D"tocnumber">6.1</SPAN> <SPAN =
- class=3D"toctext">Bencoded=20
- Strings</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-8"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Integers"><SPAN=20
- class=3D"tocnumber">6.2</SPAN> <SPAN=20
- class=3D"toctext">Integers</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-9"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Lists"><SPAN=20
- class=3D"tocnumber">6.3</SPAN> <SPAN=20
- class=3D"toctext">Lists</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-10"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Dictionaries"><SPA=
- N=20
- class=3D"tocnumber">6.4</SPAN> <SPAN=20
- class=3D"toctext">Dictionaries</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-11"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Implementations"><=
- SPAN=20
- class=3D"tocnumber">6.5</SPAN> <SPAN=20
- class=3D"toctext">Implementations</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-12"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Stru=
- cture"><SPAN=20
- class=3D"tocnumber">7</SPAN> <SPAN class=3D"toctext">Metainfo =
- File=20
- Structure</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-13"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Info_Dictionary"><=
- SPAN=20
- class=3D"tocnumber">7.1</SPAN> <SPAN class=3D"toctext">Info=20
- Dictionary</SPAN></A>
- <UL>
- <LI class=3D"toclevel-3 tocsection-14"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Info_in_Single_Fil=
- e_Mode"><SPAN=20
- class=3D"tocnumber">7.1.1</SPAN> <SPAN =
- class=3D"toctext">Info in Single=20
- File Mode</SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-15"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Info_in_Multiple_F=
- ile_Mode"><SPAN=20
- class=3D"tocnumber">7.1.2</SPAN> <SPAN =
- class=3D"toctext">Info in=20
- Multiple File Mode</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-2 tocsection-16"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Notes"><SPAN=20
- class=3D"tocnumber">7.2</SPAN> <SPAN=20
- class=3D"toctext">Notes</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-17"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Tracker_HTTP.2FHTT=
- PS_Protocol"><SPAN=20
- class=3D"tocnumber">8</SPAN> <SPAN class=3D"toctext">Tracker =
- HTTP/HTTPS=20
- Protocol</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-18"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Tracker_Request_Pa=
- rameters"><SPAN=20
- class=3D"tocnumber">8.1</SPAN> <SPAN class=3D"toctext">Tracker =
- Request=20
- Parameters</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-19"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Tracker_Response">=
- <SPAN=20
- class=3D"tocnumber">8.2</SPAN> <SPAN class=3D"toctext">Tracker =
-
- Response</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-20"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Tracker_.27scrape.=
- 27_Convention"><SPAN=20
- class=3D"tocnumber">9</SPAN> <SPAN class=3D"toctext">Tracker =
- 'scrape'=20
- Convention</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-21"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Unofficial_extensi=
- ons_to_scrape"><SPAN=20
- class=3D"tocnumber">9.1</SPAN> <SPAN =
- class=3D"toctext">Unofficial=20
- extensions to scrape</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-22"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Peer_wire_protocol=
- _.28TCP.29"><SPAN=20
- class=3D"tocnumber">10</SPAN> <SPAN class=3D"toctext">Peer wire =
- protocol=20
- (TCP)</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-23"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Overview"><SPAN=20
- class=3D"tocnumber">10.1</SPAN> <SPAN=20
- class=3D"toctext">Overview</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-24"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Data_Types"><SPAN =
-
- class=3D"tocnumber">10.2</SPAN> <SPAN class=3D"toctext">Data=20
- Types</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-25"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Message_flow"><SPA=
- N=20
- class=3D"tocnumber">10.3</SPAN> <SPAN =
- class=3D"toctext">Message=20
- flow</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-26"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Handshake"><SPAN=20
- class=3D"tocnumber">10.4</SPAN> <SPAN=20
- class=3D"toctext">Handshake</SPAN></A>
- <UL>
- <LI class=3D"toclevel-3 tocsection-27"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#peer_id"><SPAN=20
- class=3D"tocnumber">10.4.1</SPAN> <SPAN=20
- class=3D"toctext">peer_id</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-2 tocsection-28"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Messages"><SPAN=20
- class=3D"tocnumber">10.5</SPAN> <SPAN=20
- class=3D"toctext">Messages</SPAN></A>
- <UL>
- <LI class=3D"toclevel-3 tocsection-29"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#keep-alive:_.3Clen=
- .3D0000.3E"><SPAN=20
- class=3D"tocnumber">10.5.1</SPAN> <SPAN =
- class=3D"toctext">keep-alive:=20
- <len=3D0000></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-30"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#choke:_.3Clen.3D00=
- 01.3E.3Cid.3D0.3E"><SPAN=20
- class=3D"tocnumber">10.5.2</SPAN> <SPAN =
- class=3D"toctext">choke:=20
- <len=3D0001><id=3D0></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-31"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#unchoke:_.3Clen.3D=
- 0001.3E.3Cid.3D1.3E"><SPAN=20
- class=3D"tocnumber">10.5.3</SPAN> <SPAN =
- class=3D"toctext">unchoke:=20
- <len=3D0001><id=3D1></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-32"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#interested:_.3Clen=
- .3D0001.3E.3Cid.3D2.3E"><SPAN=20
- class=3D"tocnumber">10.5.4</SPAN> <SPAN =
- class=3D"toctext">interested:=20
- <len=3D0001><id=3D2></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-33"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#not_interested:_.3=
- Clen.3D0001.3E.3Cid.3D3.3E"><SPAN=20
- class=3D"tocnumber">10.5.5</SPAN> <SPAN =
- class=3D"toctext">not=20
- interested: <len=3D0001><id=3D3></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-34"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#have:_.3Clen.3D000=
- 5.3E.3Cid.3D4.3E.3Cpiece_index.3E"><SPAN=20
- class=3D"tocnumber">10.5.6</SPAN> <SPAN =
- class=3D"toctext">have:=20
- <len=3D0005><id=3D4><piece =
- index></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-35"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#bitfield:_.3Clen.3=
- D0001.2BX.3E.3Cid.3D5.3E.3Cbitfield.3E"><SPAN=20
- class=3D"tocnumber">10.5.7</SPAN> <SPAN =
- class=3D"toctext">bitfield:=20
- =
- <len=3D0001+X><id=3D5><bitfield></SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-36"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#request:_.3Clen.3D=
- 0013.3E.3Cid.3D6.3E.3Cindex.3E.3Cbegin.3E.3Clength.3E"><SPAN=20
- class=3D"tocnumber">10.5.8</SPAN> <SPAN =
- class=3D"toctext">request:=20
- =
- <len=3D0013><id=3D6><index><begin><length><=
- /SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-37"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#piece:_.3Clen.3D00=
- 09.2BX.3E.3Cid.3D7.3E.3Cindex.3E.3Cbegin.3E.3Cblock.3E"><SPAN=20
- class=3D"tocnumber">10.5.9</SPAN> <SPAN =
- class=3D"toctext">piece:=20
- =
- <len=3D0009+X><id=3D7><index><begin><block>=
- </SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-38"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#cancel:_.3Clen.3D0=
- 013.3E.3Cid.3D8.3E.3Cindex.3E.3Cbegin.3E.3Clength.3E"><SPAN=20
- class=3D"tocnumber">10.5.10</SPAN> <SPAN =
- class=3D"toctext">cancel:=20
- =
- <len=3D0013><id=3D8><index><begin><length><=
- /SPAN></A></LI>
- <LI class=3D"toclevel-3 tocsection-39"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#port:_.3Clen.3D000=
- 3.3E.3Cid.3D9.3E.3Clisten-port.3E"><SPAN=20
- class=3D"tocnumber">10.5.11</SPAN> <SPAN =
- class=3D"toctext">port:=20
- =
- <len=3D0003><id=3D9><listen-port></SPAN></A></LI></UL>
- </LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-40"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Algorithms"><SPAN =
-
- class=3D"tocnumber">11</SPAN> <SPAN =
- class=3D"toctext">Algorithms</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-41"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Queuing"><SPAN=20
- class=3D"tocnumber">11.1</SPAN> <SPAN=20
- class=3D"toctext">Queuing</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-42"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Super_Seeding"><SP=
- AN=20
- class=3D"tocnumber">11.2</SPAN> <SPAN class=3D"toctext">Super=20
- Seeding</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-43"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Piece_downloading_=
- strategy"><SPAN=20
- class=3D"tocnumber">11.3</SPAN> <SPAN class=3D"toctext">Piece =
- downloading=20
- strategy</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-44"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#End_Game"><SPAN=20
- class=3D"tocnumber">11.4</SPAN> <SPAN class=3D"toctext">End=20
- Game</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-45"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Choking_and_Optimi=
- stic_Unchoking"><SPAN=20
- class=3D"tocnumber">11.5</SPAN> <SPAN =
- class=3D"toctext">Choking and=20
- Optimistic Unchoking</SPAN></A>
- <UL>
- <LI class=3D"toclevel-3 tocsection-46"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Anti-snubbing"><SP=
- AN=20
- class=3D"tocnumber">11.5.1</SPAN> <SPAN=20
- =
- class=3D"toctext">Anti-snubbing</SPAN></A></LI></UL></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-47"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Official_Extension=
- s_To_The_Protocol"><SPAN=20
- class=3D"tocnumber">12</SPAN> <SPAN class=3D"toctext">Official =
- Extensions To=20
- The Protocol</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-48"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Fast_Peers_Extensi=
- ons"><SPAN=20
- class=3D"tocnumber">12.1</SPAN> <SPAN class=3D"toctext">Fast =
- Peers=20
- Extensions</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-49"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Distributed_Hash_T=
- able"><SPAN=20
- class=3D"tocnumber">12.2</SPAN> <SPAN =
- class=3D"toctext">Distributed Hash=20
- Table</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-50"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Connection_Obfusca=
- tion"><SPAN=20
- class=3D"tocnumber">12.3</SPAN> <SPAN =
- class=3D"toctext">Connection=20
- Obfuscation</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-51"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Unofficial_Extensi=
- ons_To_The_Protocol"><SPAN=20
- class=3D"tocnumber">13</SPAN> <SPAN class=3D"toctext">Unofficial =
- Extensions=20
- To The Protocol</SPAN></A>
- <UL>
- <LI class=3D"toclevel-2 tocsection-52"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Azureus_Messaging_=
- Protocol"><SPAN=20
- class=3D"tocnumber">13.1</SPAN> <SPAN =
- class=3D"toctext">Azureus Messaging=20
- Protocol</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-53"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#WebSeeding"><SPAN =
-
- class=3D"tocnumber">13.2</SPAN> <SPAN=20
- class=3D"toctext">WebSeeding</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-54"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Extension_protocol=
- "><SPAN=20
- class=3D"tocnumber">13.3</SPAN> <SPAN =
- class=3D"toctext">Extension=20
- protocol</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-55"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Extension_Negotiat=
- ion_Protocol"><SPAN=20
- class=3D"tocnumber">13.4</SPAN> <SPAN =
- class=3D"toctext">Extension=20
- Negotiation Protocol</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-56"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#BitTorrent_Locatio=
- n-aware_Protocol_1.0"><SPAN=20
- class=3D"tocnumber">13.5</SPAN> <SPAN =
- class=3D"toctext">BitTorrent=20
- Location-aware Protocol 1.0</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-57"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#SimpleBT_Extension=
- _Protocol"><SPAN=20
- class=3D"tocnumber">13.6</SPAN> <SPAN =
- class=3D"toctext">SimpleBT Extension=20
- Protocol</SPAN></A></LI>
- <LI class=3D"toclevel-2 tocsection-58"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#BitComet_Extension=
- _Protocol"><SPAN=20
- class=3D"tocnumber">13.7</SPAN> <SPAN =
- class=3D"toctext">BitComet Extension=20
- Protocol</SPAN></A></LI></UL></LI>
- <LI class=3D"toclevel-1 tocsection-59"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Reserved_Bytes"><S=
- PAN=20
- class=3D"tocnumber">14</SPAN> <SPAN class=3D"toctext">Reserved=20
- Bytes</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-60"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Change_Log"><SPAN =
-
- class=3D"tocnumber">15</SPAN> <SPAN class=3D"toctext">Change=20
- Log</SPAN></A></LI>
- <LI class=3D"toclevel-1 tocsection-61"><A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#Related_Links"><SP=
- AN=20
- class=3D"tocnumber">16</SPAN> <SPAN class=3D"toctext">Related=20
- Links</SPAN></A></LI></UL></TD></TR></TBODY></TABLE>
- <SCRIPT>if (window.showTocToggle) { var tocShowText =3D "show"; var =
- tocHideText =3D "hide"; showTocToggle(); } </SCRIPT>
-
- <H2> <SPAN id=3D"Identification" class=3D"mw-headline"> Identification =
- </SPAN></H2>
- <P><A class=3D"new" title=3D"BitTorrent (page does not exist)" =
- href=3D"http://wiki.theory.org/index.php?title=3DBitTorrent&action=3D=
- edit&redlink=3D1">BitTorrent</A>=20
- is a peer-to-peer file sharing protocol designed by Bram Cohen. Visit =
- his pages=20
- at <A class=3D"external free" href=3D"http://www.bittorrent.com/"=20
- rel=3D"nofollow">http://www.bittorrent.com/</A> BitTorrent is designed =
- to=20
- facilitate file transfers among multiple peers across unreliable =
- networks.</P>
- <H2> <SPAN id=3D"Purpose" class=3D"mw-headline"> Purpose </SPAN></H2>
- <P>The purpose of this specification is to document version 1.0 of the=20
- BitTorrent protocol specification in detail. Bram's <A =
- class=3D"external text"=20
- href=3D"http://bittorrent.org/beps/bep_0003.html" =
- rel=3D"nofollow">protocol=20
- specification page</A> outlines the protocol in somewhat general terms, =
- and=20
- lacks behaviorial detail in some areas. The hope is that this document =
- will=20
- become a <B>formal</B> specification, written in clear, unambiguous =
- terms, which=20
- 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=20
- the understanding that the content here is intended to represent the =
- current=20
- protocol (What if the current protocol is 2.0? The scope is then =
- conflicting),=20
- 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=20
- the <A class=3D"external text" =
- href=3D"http://lists.ibiblio.org/mailman/listinfo/bittorrent"=20
- rel=3D"nofollow">mailing list</A>.</P>
- <H2> <SPAN id=3D"Scope" class=3D"mw-headline"> Scope </SPAN></H2>
- <P>This document applies to the first version (i.e. version 1.0) of the=20
- BitTorrent protocol specification. Currently, this applies to the =
- torrent file=20
- structure, peer wire protocol, and the Tracker HTTP/HTTPS protocol=20
- specifications. As newer revisions of each protocol are defined, they =
- should be=20
- specified on their own separate pages, <B>not here</B>.</P>
- <H2> <SPAN id=3D"Related_Documents" class=3D"mw-headline"> Related =
- Documents=20
- </SPAN></H2>
- <UL>
- <LI> <A class=3D"external text" =
- href=3D"http://bittorrent.org/beps/bep_0003.html"=20
- rel=3D"nofollow">Official protocol specification</A></LI>
- <LI> <A title=3D"BitTorrentWishList" =
- href=3D"http://wiki.theory.org/BitTorrentWishList">Developer=20
- and user wishlist</A></LI>
- <LI> <A title=3D"BitTorrentTrackerExtensions" =
- href=3D"http://wiki.theory.org/BitTorrentTrackerExtensions">Tracker=20
- protocol extensions</A></LI></UL>
- <H2> <SPAN id=3D"Conventions" class=3D"mw-headline"> Conventions =
- </SPAN></H2>
- <P>In this document, a number of conventions are used in an attempt to =
- present=20
- 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=20
- BitTorrent client participating in a download. The <I>client</I> is =
- also a=20
- 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=20
- 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=20
- a portion of the downloaded data that is described in the metainfo =
- file, which=20
- can be verified by a SHA1 hash. A <I>block</I> is a portion of data =
- that a=20
- <I>client</I> may request from at least one <I>peer</I>. Two or more=20
- <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=20
- a practice so common in various client implementations of BitTorrent =
- that it=20
- is considered a defacto standard.</LI></UL>
- <P>In order to help others find recent changes that have been made to =
- this=20
- document, please fill out the change log (last section). This should =
- contain a=20
- brief (i.e. one-line) entry for each major change that you've made to =
- the=20
- document.</P>
- <H2> <SPAN id=3D"Bencoding" class=3D"mw-headline"> Bencoding =
- </SPAN></H2>
- <P>Bencoding is a way to specify and organize data in a terse format. =
- It=20
- supports the following types: byte strings, integers, lists, and =
- dictionaries.
- </P>
- <H3> <SPAN id=3D"Bencoded_Strings" class=3D"mw-headline"> Bencoded =
- Strings=20
- </SPAN></H3>
- <P>Bencoded strings are encoded as follows: <I><string length encoded =
- in base=20
- ten ASCII><B>:</B><string data></I>, or =
- <I>key</I>:<I>value</I><BR>Note=20
- 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>
- <H3> <SPAN id=3D"Integers" class=3D"mw-headline"> Integers </SPAN></H3>
- <P>Integers are encoded as follows: <I><B>i</B><integer encoded in =
- base ten=20
- ASCII><B>e</B></I><BR>The initial <B>i</B> and trailing <B>e</B> are=20
- beginning and ending delimiters. You can have negative numbers such as=20
- <I><B>i</B>-3<B>e</B></I>. Only the significant digits should be used, =
- one=20
- cannot pad the Integer with zeroes. such as <I><B>i</B>04<B>e</B></I>. =
- However,=20
- <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,=20
- but to handle it as a signed 64bit integer is mandatory to handle =
- "large=20
- files" aka .torrent for more that 4Gbyte.</LI></UL>
- <H3> <SPAN id=3D"Lists" class=3D"mw-headline"> Lists </SPAN></H3>
- <P>Lists are encoded as follows: <I><B>l</B><bencoded=20
- values><B>e</B></I><BR>The initial <B>l</B> and trailing <B>e</B> are =
-
- beginning and ending delimiters. Lists may contain any bencoded type, =
- including=20
- integers, strings, dictionaries, and even lists within other lists.</P>
- <DL>
- <DD><B>Example:</B> <I><B>l</B>4:spam4:eggs<B>e</B></I> represents the =
- list of=20
- two strings: [ "spam", "eggs" ]</DD></DL>
- <H3> <SPAN id=3D"Dictionaries" class=3D"mw-headline"> Dictionaries =
- </SPAN></H3>
- <P>Dictionaries are encoded as follows: <I><B>d</B><bencoded=20
- string><bencoded element><B>e</B></I> <BR>The initial <B>d</B> =
- and=20
- trailing <B>e</B> are the beginning and ending delimiters. Note that the =
- keys=20
- must be bencoded strings. The values may be any bencoded type, =
- including=20
- integers, strings, lists, and other dictionaries. Keys must be strings =
- and=20
- appear in sorted order (sorted as raw strings, not alphanumerics). The =
- strings=20
- should be compared using a binary comparison, not a culture-specific =
- "natural"=20
- comparison.</P>
- <DL>
- <DD><B>Example</B>: <I><B>d</B>3:cow3:moo4:spam4:eggs<B>e</B> =
- represents the=20
- dictionary { "cow" =3D> "moo", "spam" =3D> "eggs" } =
- <BR></I></DD>
- <DD><B>Example</B>: <I><B>d</B>4:spaml1:a1:b<B>ee'</B> represents the=20
- dictionary { "spam" =3D> [ "a", "b" ] } <BR></I></DD>
- <DD><B>Example</B>:=20
- =
- <I><B>d</B>9:publisher3:bob17:publisher-webpage15:www.example.com18:publi=
- sher.location4:home<B>e</B></I>=20
- represents { "publisher" =3D> "bob", "publisher-webpage" =3D>=20
- "www.example.com", "publisher.location" =3D> "home" }</DD></DL>
- <H3> <SPAN id=3D"Implementations" class=3D"mw-headline"> Implementations =
-
- </SPAN></H3>
- <UL>
- <LI> <A class=3D"external text" =
- href=3D"http://funzix.git.sourceforge.net/git/gitweb.cgi?p=3Dfunzix/funzi=
- x;a=3Dblob;f=3Dbencode/bencode.c"=20
- rel=3D"nofollow">C</A> by <A class=3D"new" title=3D"User:Vapier (page =
- does not exist)"=20
- =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Vapier&action=3D=
- edit&redlink=3D1">Mike=20
- Frysinger</A></LI>
- <LI> <A class=3D"external text" =
- href=3D"http://search.cpan.org/dist/Convert-Bencode/lib/Convert/Bencode.p=
- m"=20
- rel=3D"nofollow">Perl</A></LI>
- <LI> <A class=3D"external text" =
- href=3D"http://www.koders.com/java/fid47111A56F2466C232E09AEF75A39915EC70=
- D3536.aspx#L52"=20
- rel=3D"nofollow">Java</A></LI>
- <LI> <A title=3D"Decoding bencoded data with python" =
- href=3D"http://wiki.theory.org/Decoding_bencoded_data_with_python">Python=
- </A>=20
- by <A class=3D"new" title=3D"User:Hackeron (page does not exist)" =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Hackeron&action=
- =3Dedit&redlink=3D1">Hackeron</A>
- </LI>
- <LI> <A title=3D"Decoding encoding bencoded data with haskell" =
- href=3D"http://wiki.theory.org/Decoding_encoding_bencoded_data_with_haske=
- ll">Decoding=20
- encoding bencoded data with haskell</A> by <A class=3D"new" =
- title=3D"User:Edi (page does not exist)"=20
- =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Edi&action=3Ded=
- it&redlink=3D1">Edi</A>
- </LI>
- <LI> <A class=3D"external text" =
- href=3D"http://www.stupendous.net/projects/bencoding-obj-c-class/"=20
- rel=3D"nofollow">Objective-C</A> by <A class=3D"new" =
- title=3D"User:Chrome (page does not exist)"=20
- =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Chrome&action=3D=
- edit&redlink=3D1">Chrome</A>
- </LI>
- <LI> <A title=3D"JScript: Converting a torrent file to a JScript =
- dictionary"=20
- =
- href=3D"http://wiki.theory.org/JScript:_Converting_a_torrent_file_to_a_JS=
- cript_dictionary">JScript</A>=20
- by <A class=3D"new" title=3D"User:Sergej B. (page does not exist)" =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Sergej_B.&actio=
- n=3Dedit&redlink=3D1">Sergej=20
- B.</A></LI>
- <LI> <A class=3D"external text" =
- href=3D"http://demon.tw/my-work/javascript-bencode.html"=20
- rel=3D"nofollow">JavaScript</A> by <A class=3D"external text" =
- href=3D"http://demon.tw/"=20
- rel=3D"nofollow">Demon</A>]</LI>
- <LI> <A class=3D"external text" =
- href=3D"http://demon.tw/my-work/vbs-bencode.html"=20
- rel=3D"nofollow">VBScript</A> by <A class=3D"external text" =
- href=3D"http://demon.tw/"=20
- rel=3D"nofollow">Demon</A>]</LI>
- <LI> <A class=3D"external text" =
- href=3D"http://nakkaya.com/2009/11/02/decoding-bencoded-streams-in-clojur=
- e/"=20
- rel=3D"nofollow">Clojure</A> by <A class=3D"new" title=3D"User:Nakkaya =
- (page does not exist)"=20
- =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:Nakkaya&action=3D=
- edit&redlink=3D1">nakkaya</A>
- </LI>
- <LI> <A title=3D"Decoding encoding bencoded data with erlang" =
- href=3D"http://wiki.theory.org/Decoding_encoding_bencoded_data_with_erlan=
- g">Erlang</A>
- </LI>
- <LI> <A title=3D"Decoding encoding bencoded data with PHP" =
- href=3D"http://wiki.theory.org/Decoding_encoding_bencoded_data_with_PHP">=
- PHP</A>
- </LI>
- <LI> <A class=3D"external text" =
- href=3D"http://code.google.com/p/php-bencode-extension/"=20
- rel=3D"nofollow">PHP Extension</A></LI>
- <LI> <A class=3D"external text" =
- href=3D"http://snipplr.com/view/37790/bencoding-encoder-and-decoder/"=20
- rel=3D"nofollow">C#</A> by <A class=3D"new" title=3D"User:SuprDewd =
- (page does not exist)"=20
- =
- href=3D"http://wiki.theory.org/index.php?title=3DUser:SuprDewd&action=
- =3Dedit&redlink=3D1">SuprDewd</A>
- </LI>
- <LI> <A class=3D"external text" =
- href=3D"http://cvs.savannah.gnu.org/viewvc/mldonkey/mldonkey/src/networks=
- /bittorrent/bencode.ml?view=3Dmarkup"=20
- rel=3D"nofollow">OCaml</A> by <A class=3D"external text" =
- href=3D"http://mldonkey.sourceforge.net/Main_Page"=20
- rel=3D"nofollow">MLDonkey</A></LI>
- <LI> <A class=3D"external text" =
- href=3D"https://github.com/jsz/gorrent/tree/master/bencode"=20
- rel=3D"nofollow">Go</A> by <A class=3D"external text" =
- href=3D"http://jsz.github.com/"=20
- rel=3D"nofollow">Leon Szpilewski</A></LI></UL>
- <H2> <SPAN id=3D"Metainfo_File_Structure" class=3D"mw-headline"> =
- Metainfo File=20
- Structure </SPAN></H2>
- <P>All data in a metainfo file is bencoded. The specification for =
- bencoding is=20
- defined above.</P>
- <P>The content of a metainfo file (the file ending in ".torrent") is a =
- bencoded=20
- dictionary, containing the keys listed below. All character string =
- values are=20
- UTF-8 encoded.</P>
- <UL>
- <LI> <B>info</B>: a dictionary that describes the file(s) of the =
- torrent. =20
- There are two possible forms: one for the case of a 'single-file' =
- torrent with=20
- no directory structure, and one for the case of a 'multi-file' torrent =
- (see=20
- below for details)</LI>
- <LI> <B>announce</B>: The announce URL of the tracker (string)</LI>
- <LI> <B>announce-list</B>: (optional) this is an extention to the =
- official=20
- specification, offering backwards-compatibility. (list of lists of =
- strings).
- <UL>
- <LI>The official request for a specification change is <A =
- class=3D"external text"=20
- href=3D"http://bittorrent.org/beps/bep_0012.html" =
- rel=3D"nofollow">here</A>.
- </LI></UL></LI>
- <LI> <B>creation date</B>: (optional) the creation time of the =
- torrent, in=20
- standard UNIX epoch format (integer, seconds since 1-Jan-1970 00:00:00 =
- UTC)
- </LI>
- <LI> <B>comment</B>: (optional) free-form textual comments of the =
- author=20
- (string)</LI>
- <LI> <B>created by</B>: (optional) name and version of the program =
- used to=20
- create the .torrent (string)</LI>
- <LI> <B>encoding</B>: (optional) the string encoding format used to =
- generate=20
- the <B>pieces</B> part of the <B>info</B> dictionary in the .torrent =
- metafile=20
- (string)</LI></UL>
- <H3> <SPAN id=3D"Info_Dictionary" class=3D"mw-headline">Info =
- Dictionary</SPAN></H3>
- <P>This section contains the field which are common to both mode, =
- "single file"=20
- and "multiple file".</P>
- <UL>
- <LI> <B>piece length</B>: number of bytes in each piece (integer)</LI>
- <LI> <B>pieces</B>: string consisting of the concatenation of all =
- 20-byte SHA1=20
- hash values, one per piece (byte string, i.e. not urlencoded)</LI>
- <LI> <B>private</B>: (optional) this field is an integer. If it is set =
- to "1",=20
- the client MUST publish its presence to get other peers ONLY via the =
- trackers=20
- explicitly described in the metainfo file. If this field is set to "0" =
- or is=20
- not present, the client may obtain peer from other means, e.g. PEX =
- peer=20
- exchange, dht. Here, "private" may be read as "no external peer =
- source".
- <UL>
- <LI> <B>NOTE:</B> There is much debate surrounding private =
- trackers.</LI>
- <LI> The official request for a specification change is <A =
- class=3D"external text"=20
- href=3D"http://bittorrent.org/beps/bep_0027.html" =
- rel=3D"nofollow">here</A>.
- </LI>
- <LI> Azureus was the first client to respect private trackers, <A =
- class=3D"external text"=20
- href=3D"http://www.azureuswiki.com/index.php/Secure_Torrents"=20
- rel=3D"nofollow">see their wiki</A> for more =
- details.</LI></UL></LI></UL>
- <H4> <SPAN id=3D"Info_in_Single_File_Mode" class=3D"mw-headline">Info in =
- Single File=20
- Mode</SPAN></H4>
- <P>For the case of the <B>single-file</B> mode, the <B>info</B> =
- dictionary=20
- contains the following structure:</P>
- <UL>
- <LI> <B>name</B>: the filename. This is purely advisory. =
- (string)</LI>
- <LI> <B>length</B>: length of the file in bytes (integer)</LI>
- <LI> <B>md5sum</B>: (optional) a 32-character hexadecimal string =
- corresponding=20
- to the MD5 sum of the file. This is not used by BitTorrent at all, =
- but it is=20
- included by some programs for greater compatibility.</LI></UL>
- <H4> <SPAN id=3D"Info_in_Multiple_File_Mode" class=3D"mw-headline">Info =
- in Multiple=20
- File Mode</SPAN></H4>
- <P>For the case of the <B>multi-file</B> mode, the <B>info</B> =
- dictionary=20
- contains the following structure:</P>
- <UL>
- <LI> <B>name</B>: the file path of the directory in which to store all =
- the=20
- files. This is purely advisory. (string)</LI>
- <LI> <B>files</B>: a list of dictionaries, one for each file. Each =
- dictionary=20
- in this list contains the following keys:
- <UL>
- <LI> <B>length</B>: length of the file in bytes (integer)</LI>
- <LI> <B>md5sum</B>: (optional) a 32-character hexadecimal string=20
- corresponding to the MD5 sum of the file. This is not used by =
- BitTorrent at=20
- all, but it is included by some programs for greater =
- compatibility.</LI>
- <LI> <B>path</B>: a list containing one or more string elements that =
-
- together represent the path and filename. Each element in the list=20
- corresponds to either a directory name or (in the case of the final =
- element)=20
- the filename. For example, a the file "dir1/dir2/file.ext" would =
- consist of=20
- three string elements: "dir1", "dir2", and "file.ext". This is =
- encoded as a=20
- bencoded list of strings such as=20
- =
- <I>l<B>4</B>:dir1<B>4</B>:dir2<B>8</B>:file.ext<B>e</B></I></LI></UL></LI=
- ></UL>
- <H3> <SPAN id=3D"Notes" class=3D"mw-headline">Notes</SPAN></H3>
- <UL>
- <LI> The <B>piece length</B> specifies the nominal piece size, and is =
- usually=20
- a power of 2. The piece size is typically chosen based on the total =
- amount of=20
- file data in the torrent, and is constrained by the fact that =
- too-large piece=20
- sizes cause inefficiency, and too-small piece sizes cause large =
- .torrent=20
- metadata file. Historically, piece size was chosen to result in a =
- .torrent=20
- file no greater than approx. 50 - 75 kB (presumably to ease the load =
- on the=20
- server hosting the torrent files). =20
- <UL>
- <LI>Current best-practice is to <I>keep the piece size to 512KB or =
- less,</I>=20
- for torrents around 8-10GB, even if that results in a larger =
- .torrent file. =20
- This results in a more efficient swarm for sharing files. The most =
- common=20
- sizes are 256 kB, 512 kB, and 1 MB. </LI>
- <LI>Every piece is of equal length except for the final piece, which =
- is=20
- irregular. The number of pieces is thus determined by 'ceil( total =
- length /=20
- piece size )'. </LI>
- <LI>For the purposes of piece boundaries in the multi-file case, =
- consider=20
- the file data as one long continuous stream, composed of the =
- concatenation=20
- of each file in the order listed in the <I>files</I> list. The =
- number of=20
- pieces and their boundaries are then determined in the same manner =
- as the=20
- case of a single file. Pieces may overlap file =
- boundaries.</LI></UL></LI>
- <LI> Each piece has a corresponding SHA1 hash of the data contained =
- within=20
- that piece. These hashes are concatenated to form the <I>pieces<B> =
- value in=20
- the above </B></I><B>info</B> dictionary. Note that this is =
- <B>not</B> a list=20
- but rather a single string. The length of the string must be a =
- multiple of 20.
- </LI></UL>
- <H2> <SPAN id=3D"Tracker_HTTP.2FHTTPS_Protocol" class=3D"mw-headline"> =
- Tracker=20
- HTTP/HTTPS Protocol </SPAN></H2>
- <P>The tracker is an HTTP/HTTPS service which responds to HTTP GET =
- requests. The=20
- requests include metrics from clients that help the tracker keep overall =
-
- statistics about the torrent. The response includes a peer list that =
- helps the=20
- client participate in the torrent. The base URL consists of the =
- "announce URL"=20
- as defined in the metainfo (.torrent) file. The parameters are then =
- added to=20
- this URL, using standard CGI methods (i.e. a '?' after the announce URL, =
-
- followed by 'param=3Dvalue' sequences separated by '&').</P>
- <P>Note that all binary data in the URL (particularly info_hash and =
- peer_id)=20
- must be properly escaped. This means any byte not in the set 0-9, a-z, =
- A-Z,=20
- '.', '-', '_' and '~', must be encoded using the "%nn" format, where nn =
- is the=20
- hexadecimal value of the byte. (See <A class=3D"external text" =
- href=3D"http://www.faqs.org/rfcs/rfc1738.html"=20
- rel=3D"nofollow">RFC1738</A> for details.) </P>
- <P>For a 20-byte hash of=20
- \x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\=
- x78\x9a,<BR>
- The right encoded form =
- is %124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A</P>
- <H3> <SPAN id=3D"Tracker_Request_Parameters" =
- class=3D"mw-headline">Tracker Request=20
- Parameters</SPAN></H3>
- <P>The parameters used in the client->tracker GET request are as =
- follows:</P>
- <UL>
- <LI> <B>info_hash</B>: urlencoded 20-byte SHA1 hash of the =
- <I>value</I> of the=20
- <I>info</I> key from the Metainfo file. Note that the <I>value</I> =
- will be a=20
- bencoded dictionary, given the definition of the <I>info</I> key =
- above. </LI>
- <LI> <B><A=20
- =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#peer_id">peer_id</=
- A></B>:=20
- urlencoded 20-byte string used as a unique ID for the client, =
- generated by the=20
- client at startup. This is allowed to be any value, and may be binary =
- data. =20
- <I>There are currently no guidelines for generating this peer ID. =
- However,=20
- one may rightly presume that it must at least be unique for your local =
-
- machine, thus should probably incorporate things like process ID and =
- perhaps a=20
- timestamp recorded at startup. See <A =
- href=3D"http://wiki.theory.org/BitTorrentSpecification#peer_id">peer_id=20
- </A> below for common client encodings of this field.</I></LI>
- <LI> <B>port</B>: The port number that the client is listening on. =
- Ports=20
- reserved for BitTorrent are typically 6881-6889. Clients may choose =
- to give=20
- up if it cannot establish a port within this range.</LI>
- <LI> <B>uploaded</B>: The total amount uploaded (since the client sent =
- the=20
- 'started' event to the tracker) in base ten ASCII. While not =
- explicitly=20
- stated in the official specification, the concensus is that this =
- should be the=20
- total number of bytes uploaded.</LI>
- <LI> <B>downloaded</B>: The total amount downloaded (since the client =
- sent the=20
- 'started' event to the tracker) in base ten ASCII. While not =
- explicitly=20
- stated in the official specification, the consensus is that this =
- should be the=20
- total number of bytes downloaded.</LI>
- <LI> <B>left</B>: The number of bytes this client still has to =
- download in=20
- base ten ASCII.</LI>
- <LI> <B>compact</B>: Setting this to 1 indicates that the client =
- accepts a=20
- compact response. The announce-list is replaced by a peers string with =
- 6 bytes=20
- per peer. The first four bytes are the host (in network byte order), =
- the last=20
- two bytes are the port (again in network byte order). It should be =
- noted that=20
- some trackers only support compact responses (for saving bandwidth) =
- and either=20
- refuse requests without "compact=3D1" or simply send a compact =
- response unless=20
- the request contains "compact=3D0" (in which case they will refuse the =
- request.)
- </LI>
- <LI> <B>no_peer_id</B>: Indicates that the tracker can omit peer id =
- field in=20
- announce-list dictionary. This option is ignored if compact is =
- enabled.</LI>
- <LI> <B>event</B>: If specified, must be one of <I>started</I>,=20
- <I>completed</I>, <I>stopped</I>, (or empty which is the same as not =
- being=20
- specified). If not specified, then this request is one performed at =
- regular=20
- intervals.
- <UL>
- <LI> <B>started</B>: The first request to the tracker <I>must</I> =
- include=20
- the event key with this value.</LI>
- <LI> <B>stopped</B>: Must be sent to the tracker if the client is =
- shutting=20
- down gracefully.</LI>
- <LI> <B>completed</B>: Must be sent to the tracker when the download =
-
- completes. However, must not be sent if the download was already =
- 100%=20
- complete when the client started. Presumably, this is to allow the =
- tracker=20
- to increment the "completed downloads" metric based solely on this =
- event.
- </LI></UL></LI>
- <LI> <B>ip</B>: Optional. The true IP address of the client machine, =
- in=20
- dotted quad format or rfc3513 defined hexed IPv6 address. <I>Notes: =
- In=20
- general this parameter is not necessary as the address of the client =
- can be=20
- determined from the IP address from which the HTTP request came. The=20
- parameter is only needed in the case where the IP address that the =
- request=20
- came in on is not the IP address of the client. This happens if the =
- client is=20
- communicating to the tracker through a proxy (or a transparent web=20
- proxy/cache.) It also is necessary when both the client and the =
- tracker are=20
- on the same local side of a NAT gateway. The reason for this is that=20
- otherwise the tracker would give out the internal (RFC1918) address of =
- the=20
- client, which is not routable. Therefore the client must explicitly =
- state its=20
- (external, routable) IP address to be given out to external peers. =
- Various=20
- trackers treat this parameter differently. Some only honor it only if =
- the IP=20
- address that the request came in on is in RFC1918 space. Others honor =
- it=20
- unconditionally, while others ignore it completely. In case of IPv6 =
- address=20
- (e.g.: 2001:db8:1:2::100) it indicates only that client can =
- communicate via=20
- IPv6.</I></LI>
- <LI> <B>numwant</B>: Optional. Number of peers that the client would =
- like to=20
- receive from the tracker. This value is permitted to be zero. If =
- omitted,=20
- typically defaults to 50 peers.</LI>
- <LI> <B>key</B>: Optional. An additional client identification =
- mechanism that=20
- is not shared with any peers. It is intended to allow a client to =
- prove their=20
- identity should their IP address change.</LI>
- <LI> <B>trackerid</B>: Optional. If a previous announce contained a =
- tracker=20
- id, it should be set here.</LI></UL>
- <H3> <SPAN id=3D"Tracker_Response" class=3D"mw-headline">Tracker=20
- Response</SPAN></H3>
- <P>The tracker responds with "text/plain" document consisting of a =
- bencoded=20
- dictionary with the following keys:</P>
- <UL>
- <LI> <B>failure reason</B>: If present, then no other keys may be =
- present. =20
- The value is a human-readable error message as to why the request =
- failed=20
- (string).</LI>
- <LI> <B>warning message</B>: (new, optional) Similar to failure =
- reason, but=20
- the response still gets processed normally. The warning message is =
- shown just=20
- like an error.</LI>
- <LI> <B>interval</B>: Interval in sec…
Large files files are truncated, but you can click here to view the full file