public static ByteString CreateTestResponseString()
 {
     Hashtable response = new Hashtable();
     response["interval"] = 10;
     response["tracker id"] = "some tracker id";
     response["complete"] = 1;
     response["incomplete"] = 2;
     response["peers"] = new ByteString(new byte[] { 127, 0, 0, 1, 0x1a, 0xe1, 207, 142, 131, 248, 0x1a, 0xe2, 105, 100, 107, 120, 0x1a, 0xe3 });
     ByteString encodedResponseBody = new ByteString(BEncoder.Encode(response));
     return new ByteString(string.Format("HTTP/1.1 OK\r\n\r\n{0}", encodedResponseBody.ToString()));
 }
Esempio n. 2
0
 private static void Encode(ByteString s, Stream buffer)
 {
     byte[] bytes = new ByteString(string.Format("{0}:{1}", s.ToString().Length, s)).ToBytes();
     buffer.Write(bytes, 0, bytes.Length);
 }
Esempio n. 3
0
 public PeerId(ByteString id):this(id.ToString())
 {
     
 }
Esempio n. 4
0
 public PeerId(ByteString id) : this(id.ToString())
 {
 }