{"id":187544,"date":"2013-07-23T14:44:03","date_gmt":"2013-07-23T10:44:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=187544"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=187544","title":{"rendered":"<span class=\"post_title\">BitTorrent Tracker \u043d\u0430 C#<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0438\u0441\u043a\u0430\u043b \u0432 \u0441\u0435\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e tracker-\u0430 \u043d\u0430 C#, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u043e\u0438 \u043f\u043e\u0438\u0441\u043a\u0438 \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u043d\u0435 \u0443\u0432\u0435\u043d\u0447\u0430\u043b\u0438\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 tracker-\u0430 \u043d\u0430 C#, \u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u2014 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438. \u0410 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u0435\u0435 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430\u2026<\/p>\n<p>  <a name=\"habracut\"><\/a>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u2014 \u044d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 BitTorrent: <a href=\"http:\/\/www.bittorrent.org\/beps\/bep_0003.html\">www.bittorrent.org\/beps\/bep_0003.html<\/a>.<\/p>\n<p>  \u0412 \u043d\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438: info_hash, peer_id, ip, port, uploaded, downloaded, left \u0438 event.<\/p>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0411\u0414 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"sql\">CREATE TABLE [dbo].[psy_trance_fm_bittorrent_announces] ( \t[id] [int] IDENTITY(1,1) NOT NULL, \t[info_hash] [char](40) NOT NULL, \t[peer_id] [char](40) NOT NULL, \t[ip] [varchar](512) NOT NULL, \t[port] [int] NOT NULL, \t[uploaded] [int] NOT NULL, \t[downloaded] [int] NOT NULL, \t[left] [int] NOT NULL, \t[event] [varchar](512) NULL ) <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 text\/plain \u0432 \u0432\u0438\u0434\u0435 bencoded-\u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>  Bencoded-\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: string, int, list \u0438 dictionary.<\/p>\n<p>  \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 bencode \u2014 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"cs\">        public string encode(string _string)         {             StringBuilder string_builder = new StringBuilder();              string_builder.Append(_string.Length);             string_builder.Append(&quot;:&quot;);             string_builder.Append(_string);                          return string_builder.ToString();         } <\/code><\/pre>\n<pre><code class=\"cs\">        public string encode(int _int)         {             StringBuilder string_builder = new StringBuilder();              string_builder.Append(&quot;i&quot;);             string_builder.Append(_int);             string_builder.Append(&quot;e&quot;);              return string_builder.ToString();         } <\/code><\/pre>\n<pre><code class=\"cs\">        public string encode(List&lt;object&gt; list)         {             StringBuilder string_builder = new StringBuilder();              string_builder.Append(&quot;l&quot;);              foreach (object _object in list)             {                   if (_object.GetType() == typeof(string))                 {                     string_builder.Append(encode((string)_object));                 }                  if (_object.GetType() == typeof(int))                 {                     string_builder.Append(encode((int)_object));                 }                  if (_object.GetType() == typeof(List&lt;object&gt;))                 {                     string_builder.Append(encode((List&lt;object&gt;)_object));                 }                  if (_object.GetType() == typeof(SortedDictionary&lt;string, object&gt;))                 {                     string_builder.Append(encode((SortedDictionary&lt;string, object&gt;)_object));                 }              }              string_builder.Append(&quot;e&quot;);              return string_builder.ToString();         } <\/code><\/pre>\n<pre><code class=\"cs\">        public string encode(SortedDictionary&lt;string, object&gt; sorted_dictionary)         {                         StringBuilder string_builder = new StringBuilder();              string_builder.Append(&quot;d&quot;);              foreach (KeyValuePair&lt;string, object&gt; key_value_pair in sorted_dictionary)             {                 string_builder.Append(encode((string)key_value_pair.Key));                                  if (key_value_pair.Value.GetType() == typeof(string))                 {                     string_builder.Append(encode((string)key_value_pair.Value));                 }                  if (key_value_pair.Value.GetType() == typeof(int))                 {                     string_builder.Append(encode((int)key_value_pair.Value));                 }                  if (key_value_pair.Value.GetType() == typeof(List&lt;object&gt;))                 {                     string_builder.Append(encode((List&lt;object&gt;)key_value_pair.Value));                 }                  if (key_value_pair.Value.GetType() == typeof(SortedDictionary&lt;string, object&gt;))                 {                     string_builder.Append(encode((SortedDictionary&lt;string, object&gt;)key_value_pair.Value));                 }             }              string_builder.Append(&quot;e&quot;);              return string_builder.ToString();         } <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u0438\u043f SortedDictionary&lt;string, object&gt;, \u0430 \u043d\u0435 Dictionary&lt;string, object&gt;. \u0412\u0441\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0438 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>  \u041d\u0443 \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435\u2026<\/p>\n<p>  \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 GET-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 info_hash \u0438 peer_id \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Request.QueryString[\u00abinfo_hash\u00bb] \u0438 Request.QueryString[\u00abpeer_id\u00bb] \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u043e \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u043f\u043e\u043b\u043d\u0435\u0439\u0448\u0443\u044e \u0431\u0435\u043b\u0438\u0431\u0435\u0440\u0434\u0443. \u042f \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043c\u043e\u0433 \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0447\u0435\u043c \u0436\u0435 \u0434\u0435\u043b\u043e\u2026<\/p>\n<p>  \u0410 \u0434\u0435\u043b\u043e \u0431\u044b\u043b\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: info_hash, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: %124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A. Request.QueryString[info_hash] \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 UTF-8 \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0435\u0435.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 Reflector-\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e FillFromString, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Request.Url.Query, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u00ab\u0441\u044b\u0440\u0443\u044e\u00bb \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f \u0432\u0437\u044f\u043b \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FillFromString \u0438\u0437 Reflector-\u0430 \u0438 \u0443\u0431\u0440\u0430\u043b \u0438\u0437 \u043d\u0435\u0433\u043e \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0445 \u0437\u0430 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cs\">        string s = Request.Url.Query.Substring(1);          SortedDictionary&lt;string, object&gt; parameters = new SortedDictionary&lt;string, object&gt;(StringComparer.Ordinal);          int num = (s != null) ? s.Length : 0;         for (int i = 0; i &lt; num; i++)         {             int startIndex = i;             int num4 = -1;             while (i &lt; num)             {                 char ch = s[i];                 if (ch == '=')                 {                     if (num4 &lt; 0)                     {                         num4 = i;                     }                 }                 else if (ch == '&')                 {                     break;                 }                 i++;             }             string str = null;             string str2 = null;             if (num4 &gt;= 0)             {                 str = s.Substring(startIndex, num4 - startIndex);                 str2 = s.Substring(num4 + 1, (i - num4) - 1);             }             else             {                 str2 = s.Substring(startIndex, i - startIndex);             }              parameters.Add(&quot;@&quot; + str, str2);         } <\/code><\/pre>\n<p>  \u041d\u0443 \u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c info_hash \u0438 peer_id \u0432 \u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0435\u0449\u0435 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">        parameters[&quot;@info_hash&quot;] = BitConverter.ToString(HttpUtility.UrlDecodeToBytes((string)parameters[&quot;@info_hash&quot;])).Replace(&quot;-&quot;, &quot;&quot;).ToLower();         parameters[&quot;@peer_id&quot;] = BitConverter.ToString(HttpUtility.UrlDecodeToBytes((string)parameters[&quot;@peer_id&quot;])).Replace(&quot;-&quot;, &quot;&quot;).ToLower(); <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, ip \u0438 event \u2014 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. Ip \u0431\u043e\u043b\u044c\u0448\u0438\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442, \u0430 event \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0440\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445: started, completed \u0438 stopped.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0438 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0443 \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445:<\/p>\n<pre><code class=\"cs\">        if (parameters.ContainsKey(&quot;@ip&quot;) == false)         {             parameters.Add(&quot;@ip&quot;, Request.UserHostAddress);         }          if (parameters.ContainsKey(&quot;@event&quot;) == false)         {             parameters.Add(&quot;@event&quot;, DBNull.Value);         } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0430\u0447\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c info_hash \u0438 peer_id, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0435, \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0440\u0430\u0437\u0434\u0430\u0447\u0435.<\/p>\n<p>  psy_trance_fm.execute_scalar \u0438 psy_trance_fm.execute_non_query \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043d\u0438 \u043e\u0447\u0435\u043d\u044c \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0445 \u0437\u0434\u0435\u0441\u044c \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0432\u0438\u0436\u0443. <\/p>\n<pre><code class=\"cs\">        psy_trance_fm psy_trance_fm = new psy_trance_fm();          if (psy_trance_fm.execute_scalar(&quot;SELECT * FROM [dbo].[psy_trance_fm_bittorrent_announces] WHERE [info_hash] = @info_hash AND [peer_id] = @peer_id&quot;, parameters, CommandType.Text) == null)         {             psy_trance_fm.execute_non_query(&quot;INSERT INTO [dbo].[psy_trance_fm_bittorrent_announces] ([info_hash], [peer_id], [ip], [port], [uploaded], [downloaded], [left], [event]) VALUES (@info_hash, @peer_id, @ip, @port, @uploaded, @downloaded, @left, @event)&quot;, parameters, CommandType.Text);         }         else         {             psy_trance_fm.execute_non_query(&quot;UPDATE [dbo].[psy_trance_fm_bittorrent_announces] SET [ip] = @ip, [port] = @port, [uploaded] = @uploaded, [downloaded] = @downloaded, [left] = @left, [event] = @event WHERE [info_hash] = @info_hash AND [peer_id] = @peer_id&quot;, parameters, CommandType.Text);         } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0411\u0414 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c bencoded-\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<p>  \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">        SortedDictionary&lt;string, object&gt; sorted_dictionary = new SortedDictionary&lt;string, object&gt;(StringComparer.Ordinal);          sorted_dictionary.Add(&quot;interval&quot;, 60);          List&lt;object&gt; peers = new List&lt;object&gt;();          DataTable data_table = psy_trance_fm.fill(&quot;SELECT * FROM [dbo].[psy_trance_fm_bittorrent_announces] WHERE [info_hash] = @info_hash&quot;, parameters, CommandType.Text);          foreach (DataRow data_row in data_table.Rows)         {             SortedDictionary&lt;string, object&gt; peer = new SortedDictionary&lt;string, object&gt;(StringComparer.Ordinal);              peer.Add(&quot;peer id&quot;, data_row[&quot;peer_id&quot;]);             peer.Add(&quot;ip&quot;, data_row[&quot;ip&quot;]);             peer.Add(&quot;port&quot;, data_row[&quot;port&quot;]);              peers.Add(peer);         }          sorted_dictionary.Add(&quot;peers&quot;, peers);                  bencode bencode = new bencode();         Response.Write(bencode.encode(sorted_dictionary)); <\/code><\/pre>\n<p>  \u041d\u0443 \u0432\u043e\u0442 \u0438 \u0432\u0441\u0435! \u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 C# BitTorrent Tracker \u0433\u043e\u0442\u043e\u0432. \u0414\u0430, \u0432 \u043d\u0435\u043c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435-\u043f\u0440\u043e\u0447\u0435\u0435-\u043f\u0440\u043e\u0447\u0435\u0435. \u041d\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<p>  \u042f \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043b\u044e\u0434\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0430\u0434\u0443\u0442 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/187544\/\"> http:\/\/habrahabr.ru\/post\/187544\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0438\u0441\u043a\u0430\u043b \u0432 \u0441\u0435\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0433\u043e tracker-\u0430 \u043d\u0430 C#, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u043e\u0438 \u043f\u043e\u0438\u0441\u043a\u0438 \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u043d\u0435 \u0443\u0432\u0435\u043d\u0447\u0430\u043b\u0438\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 tracker-\u0430 \u043d\u0430 C#, \u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u2014 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438. \u0410 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u0435\u0435 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-187544","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/187544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187544"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/187544\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}