Getting seeders and liquors to clean from udp tracker

I am trying to implement a scrape method for a UDP tracker, but I keep getting 0 planters / leechers as a response. I am still getting 2 as an action, so no error is reported. I have hardcoded the hash here to show that it does not affect the result I get.

    final ByteArrayOutputStream byteStream =new ByteArrayOutputStream();
    final DataOutputStream dataStream =new DataOutputStream(byteStream);
    dataStream.writeInt(connectResponse.get("connectionId0"));
    dataStream.writeInt(connectResponse.get("connectionId1"));
    dataStream.writeInt(2);
    dataStream.write(connectResponse.get("transactionId"));
    bencodeWriter.write(byteOut.toString());
    dataStream.writeChars("1D19CC96C1A4965D184E4B215942DBC0A09FF8F2");
    dataStream.close();
    final byte[] scrapeBytes= byteStream.toByteArray();

      

I tried different trackers but got the same answer. What could be the problem?

Edit: Added a hex dump of all requests and responses:

Connect request: Connect request

Connect the answer: Connect answer

Cleaning request: Cleaning request

Scratch answer: Scrape response

+3


source to share


1 answer


In a Scrape request,
transaction_id

= is 0x36

sent as one byte instead of 4 bytes = 0x00000036


and info_hash

sent as an 80 byte string, which is hex encoded, each character appended with a zero byte 0x00

instead of a 20 byte string. I.E. 0x0031004400310039...

instead0x1D19...



There are no peers in Scrape's response as there are no torrents with info_hash data sent in the request.

+2


source







All Articles