title: Bittorrent Connection ID mismatch
body: <p>I'm trying to send a connection message to and UDP tracker. When I send the following connection message. I get a message back containing the error: Connection ID mismatch.</p>
  
  <p>I'm using this <a href="http://www.bittorrent.org/beps/bep_0015.html/" rel="nofollow">specification</a>.</p>
  
  <blockquote>
  <pre><code>        // CONNECTION MESSAGE
          int action = 0;
          long connectionID = 0x41727101980;          
          int sessionId = new Random().Next();
  </code></pre>
  </blockquote>
  
  <pre><code>        List&lt;byte&gt; message = new List&lt;byte&gt;();
          message.AddRange(BitConverter.GetBytes(connectionID));
          message.AddRange(BitConverter.GetBytes(action));
          message.AddRange(BitConverter.GetBytes(sessionId));
  
          byte[] messageData = message.ToArray();
          if (BitConverter.IsLittleEndian)
              Array.Reverse(messageData);
  
  
          int n = 0;
          while(!response)
          {
              Thread.Sleep(15 * 2 * n++ * 1000);
              Send(messageData);
          }
  </code></pre>