source: trunk/doc/extended-messaging.txt @ 7196

Last change on this file since 7196 was 7196, checked in by charles, 13 years ago

annotate the ut_pex message to (1) take partial seeds into account, and (2) tell not to send periodic pex messages when there are no added or dropped peers.

File size: 2.4 KB
Line 
1A client that understands extended messages should set the 5th
2bit of the 6th byte of the reserved area in the handshake.  For
3example: reserved[5] = 0x10
4
5If the above bit is set in both peers' handshakes then they may
6exchange extended messages, which use id 20.  The first byte of an
7extended message (after the 4-byte length and 1-byte id, of course) is
8the extended message id.  The first extended message that should be
9sent is a handshake message, which always has an extended id of 0.
10
11The handshake message informs the peer which extended messages are
12supported and what their extended id will be.  The message payload is
13a bencoded dictionary which may have some of the following keys:
14    e
15        int, 1 or 0. a flag to denote whether the peer prefers
16        encrypted connections.  This is used in ut_pex's "added.f".
17    m
18        dict containing supported extended messages and the extended id used
19    p
20        int, tcp port for incoming peer connections
21    v
22        string, client name and version.  eg: Transmission 0.7
23
24A peer may re-send the handshake message at any time to add new
25extended message, or to disable previous messages by sending 0 as
26their extended id.
27
28uTorrent peer exchange messages use the key "ut_pex" in the m
29dictionary.  If the uTorrent peer has pex disabled, this key
30will not be present.  Exchanges messages should be sent approximately
31once every minute when peers have been added or dropped.
32
33If peers have not been added or dropped, uTorrent does not send
34the periodic PEX message.  If uTorrent 1.8.1 recieves an "empty"
35pex message from Transmission 1.40, it appears to interpret this
36as an invalid message and disconnect from Transmission.
37
38The payload of a peer exchange message is a
39bencoded dictionary with the following keys:
40
41    added
42        string, contains peers in the compact tracker format
43        (ie: 6 bytes for IPv4 address and port in network byte order)
44        added since the last peer exchange message
45
46    added.f
47        string, one byte of flags for each peer in the above added string.
48        according to libtorrent's ut_pex.c:
49        0x01 - peer supports encryption
50        0x02 - peer is a seed or a partial seed
51
52    dropped
53        same format as added, contains peers dropped since last peer exchange
54
55In contrast to Azureus' maximum of 50 peers per pex burst, uTorrent will
56hold up to 200.  alus reports: "uT stores max 200 from other peers, but it
57will send everything it has."
Note: See TracBrowser for help on using the repository browser.