I am trying to format a tracker request using BitTorrentSpecification but I don't get how to format the plan string peerID I am generating. A sample of both from my program is:
New Session ID generated: -MC0001-948902816289
Session ID URLEncoded: %-M%C0%00%1-%94%89%02%81%62%89
Do I send that? I am getting Invalid request from the server... I have tested and my info_hash is valid. Sample request below.
http://tracker.tfile.me/announce?info_hash=%B5%E1%3F%36%35%09%62%85%A2%F4%B9%C8%9A%75%E9%F1%CC%BD%C3%CD&peer_id=%-M%C0%00%1-%94%89%02%81%62%89&port=6888&uploaded=0&downloaded=0&left=4018984971&compact=0
The URLencoding of the peer_id is not correctly done and it don't need to be URLencoded, as all the characters in it is URL-safe. Send it as: ...&peer_id=-MC0001-948902816289&...
Also, compact=1
is more or less obligatory today. Very few trackers support the legacy non compact reply. Change to ...&compact=1
and it will work.
There is also no event=started
, it should be there if it's the first time the tracker is contacted.
Send:
http://tracker.tfile.me/announce?info_hash=%B5%E1%3F%36%35%09%62%85%A2%F4%B9%C8%9A%75%E9%F1%CC%BD%C3%CD&peer_id=-MC0001-948902816289&port=6888&uploaded=0&downloaded=0&left=4018984971&event=started&compact=1
and the reply is:
d8:completei0e10:downloadedi0e10:incompletei1e8:intervali2988e12:min intervali1494e5:peers6:******