2

I'm creating a BitTorrent client in Go and having trouble obtaining peers from UDP tracker servers. My announce response looks correct, except I'm not receiving the correct peers. Im trying multiple trackers for each torrent, and for each torrent and tracker, I'm receiving the same response, 1 single peer with always the same IP and port. Reading from the socket gives me at most 26 bytes, meaning that the server is definitely only sending back 1 peer. (20 byte response + 6 bytes per peer) Any guidance as to what more info I can provide to help debug this would be great!

My Announce request looks as such:

enter image description here

The Announce response looks as such:

enter image description here

LaurentL
  • 203
  • 1
  • 3
  • 11
  • "I'm not receiving the correct peers." How do you know? If all trackers agree with each other (and they are in fact independent of each other) it is more likely that they *are* correct and your expectation is wrong. – Peter Apr 23 '20 at 08:15
  • Good point, let me clarify what I meant :) For every single torrents that I’ve tried, I’m also receiving that same peer, that’s why I’m suspicious. These torrents are also said to have hundreds of peers, so receiving only 1 is odd. – LaurentL Apr 23 '20 at 17:31

1 Answers1

1

Turns out I was not decoding the info hash in the magnet link from a hex string into a byte[] before sending it to the server.

LaurentL
  • 203
  • 1
  • 3
  • 11