Get the peer list from Tracker

xiaoxiao2021-03-06  39

After getting a TRACKER list, the next job is to get the peer list .Tracker uses the HTTP protocol. The client sends a standard GET request to the server, you can get this list. Tracker returned by the information is Bencode encoding. To Tracker The sent GET request has some parameters: info_hash (must): This value is calculated in the SHA1.TORRENT file parser in the Torrent file, saved in the M_Infohash member of the CTORRENTPARSER. Per_ID (must): Node ID, Long 20 Bytes. Usually each download produces a corresponding ID. You can identify most client types. IP (optional): The client specified by the client is interactive with local interactive IP. Generally, this is not specified Parameters unless the client uses a proxy or port mapping. Pot (Optional): Local listening port .uploaded: The number of bytes already uploaded. Download: The number of bytes already downloaded .left: Numeral Number .Event: This parameter can be the following value: Started: Download Start Completed: Download Stopped: Download Stop Compact: This parameter value is 1, indicates a list of nodes that expect to get a compact mode. Otherwise It is expected to get a list of nodes in normal mode. NO_PEER_ID (optional): It is 1, indicating that no node ID information is required. Usually Tracker will return error code 200. If the return Bencode encoding contains the Failure Reason field, the processing request failed The value of this field is the reason for the failure. If the request is successful, there are two fields that must appear: peers: Node list Interval: The next query interval of the server expects, the unit is usually the following fields. : DONE Peers: Download Number Num Peers or Incomplete: The currently downloaded node number of normal mode The PEERS field includes IP, port two fields, if the NO_PEER_ID parameter will also include the peer ID field. Below is Normal mode reply: D8: Intervali3600E5: PeerSld2: IP13: 192.168.24.527: peer ID20: {peer_id} 4: Porti 2001eed2: ip11: 192.168.0.37: peer id20: {peer_id} 4: porti6889eeee d8: intervali3600e5: peersld2: ip13: 192.168.24.524: porti2001eed2: ip11: 192.168.0.34: return to its peers porti6889eeee field model is a compact structure of the Array: Struct Peer {DWORD IP; // Node IP Word Port; // Node Port};, for example: 192.168.24.52: 2001 => 0xc0 0xA8 0x18 0x34 0x07 Next is a reply example below: D8: Intervali3600E5: Peers12: {12 Characters Of Binary Data} E In Yaseso Forum has a test program BTTrackerTestSt from Tracker to get the peer list.

转载请注明原文地址:https://www.9cbs.com/read-68380.html

New Post(0)