miivi - dht probe

From: Ty Heath <heath_at_mediadefender.com>
Date: Fri, 18 May 2007 11:45:12 -0700

Here is the code I use to send a hello request to a client:

   ByteBufferWrapper request(hello_req_buffer,sizeof
(hello_req_buffer)); //create an object that wraps a byte*, for
easy, safe and readable i/o

   request.WriteByte(0xe9); //dht protocol
   request.WriteByte(0x55); //opcode - DHT_HELLO_REQ

   request.WriteBytes(fake_user_hash,16); //Pick a random hash to
put here, but make it constant (don't do a different random hash to
every client you talk to)
   request.WriteDWord(m_my_ip); //your ip, this field can be any
value because the peer just uses the source ip of the packet.
   request.WriteWord(DHTPORT); //whatever port you are listening on
   request.WriteWord(DHTPORT); //whatever port you are listening on,
always the same as the previous word, because wasting bandwidth is cool.
   request.WriteByte(0); //NULL byte on the end for no apparent
reason, because wasting bandwidth is cool.

Received on Fri Sep 14 2007 - 10:55:50 BST

This archive was generated by hypermail 2.2.0 : Sun Sep 16 2007 - 22:19:45 BST