2

I'm making a torrent client and I need to include DHT connection to my program. I have found some static DHT nodes, but I cannot get connected to any of them. I'm sending a Ping query with my port and the torrent info hash to this address, but I'm not getting any response.

router.bittorrent.com:6881
router.utorrent.com:6881
dht.transmissionbt.com:6881
dht.aelitis.com
woland
  • 157
  • 2
  • 12

1 Answers1

2

I'm sending a Ping query with my port and the torrent info hash to this address

That doesn't make any sense. DHT ping requests do not contain any info-hashes.

but I'm not getting any response.

Your packet may be malformed and thus the nodes simply don't respond to your requests.

If you want to rule out networking issues I suggest running a bittorrent client with DHT support in your network and simply pinging that instead. Conceptually bootstrap nodes are no different from regular nodes except for their known and fixed hostname and port, so you can simply test against nodes you control instead.

dht.aelitis.com

To my knowledge this one is for the Vuze DHT which has a separate protocol.

the8472
  • 40,999
  • 5
  • 70
  • 122
  • Sorry, my question is not correct. I'm try connect to socket using udp protocol and after this I'm sending Ping query with my own id. I'm creating this id randomly. It is a 20 byte string. Do I need make it in big-endian? – woland Dec 29 '14 at 09:48
  • If you ask about endianness you don't seem to understand bencoding, because that's endianness-agnostic. Anyway, you haven't provided enough information to make any further diagnosis. – the8472 Dec 29 '14 at 14:03
  • The node-ID is stored as a 20 bytes string and is big-endian. Also be aware that http://bittorrent.org/beps/bep_0042.html updates how a node-ID is generated. – Encombe Jan 24 '15 at 23:39
  • bencoding doesn't really have endianness since everything is byte-based, not word-based. – the8472 Jan 25 '15 at 20:46
  • It's correct that bencoding has no endianness. However when you store the 160 bit node-ID as byte string, it will have a endianness. When you transmit that (bencoded) byte string both the sender and receiver needs to use the same endianness. – Encombe Jan 26 '15 at 03:44
  • I'm not aware of any platform-specific endianness mapping you would have to do to those strings. – the8472 Jan 26 '15 at 06:05
  • The 20 byte string is an 160 bit unsigned integer that is big-endian aka network byte order. From: http://bittorrent.org/beps/bep_0005.html "the value is a 20-byte string containing the senders node ID in network byte order". Even in bencode there is an endianness, as decimal values is big-endian. – Encombe Feb 01 '15 at 09:38