.. include:: header.rst

`home`__

__ reference.html

.. contents:: Table of contents
  :depth: 2
  :backlinks: none

.. raw:: html

	<a name="announce_infohash"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_infohash&labels=documentation&body=Documentation+under+heading+%22class+announce_infohash%22+could+be+improved">report issue</a>]</span>



announce_infohash
-----------------

Declared in "`libtorrent/announce_entry.hpp`__"


__ include/libtorrent/announce_entry.hpp





.. parsed-literal::
	

	struct announce_infohash
	{
	   std::string message;
	   error_code last_error;
	   int **scrape_incomplete**  = -1;
	   int **scrape_complete**  = -1;
	   int **scrape_downloaded**  = -1;
	   std::uint8_t fails : 7;
	   bool updating : 1;
	   bool start_sent : 1;
	   bool complete_sent : 1;
	};

.. raw:: html

	<a name="message"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bmessage%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bmessage%5D%22+could+be+improved">report issue</a>]</span>


message
	if this tracker has returned an error or warning message
	that message is stored here
	


.. raw:: html

	<a name="last_error"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Blast_error%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Blast_error%5D%22+could+be+improved">report issue</a>]</span>


last_error
	if this tracker failed the last time it was contacted
	this error code specifies what error occurred
	


.. raw:: html

	<a name="scrape_incomplete"></a>
	<a name="scrape_complete"></a>
	<a name="scrape_downloaded"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bscrape_incomplete+scrape_complete+scrape_downloaded%5D%22+could+be+improved">report issue</a>]</span>


scrape_incomplete scrape_complete scrape_downloaded
	if this tracker has returned scrape data, these fields are filled in
	with valid numbers. Otherwise they are set to -1. ``incomplete`` counts
	the number of current downloaders. ``complete`` counts the number of
	current peers completed the download, or "seeds". ``downloaded`` is the
	cumulative number of completed downloads.
	


.. raw:: html

	<a name="fails"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bfails%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bfails%5D%22+could+be+improved">report issue</a>]</span>


fails
	the number of times in a row we have failed to announce to this
	tracker.
	


.. raw:: html

	<a name="updating"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bupdating%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bupdating%5D%22+could+be+improved">report issue</a>]</span>


updating
	true while we're waiting for a response from the tracker.
	


.. raw:: html

	<a name="start_sent"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bstart_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bstart_sent%5D%22+could+be+improved">report issue</a>]</span>


start_sent
	set to true when we get a valid response from an announce
	with event=started. If it is set, we won't send start in the subsequent
	announces.
	


.. raw:: html

	<a name="complete_sent"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_infohash%3A%3A%5Bcomplete_sent%5D&labels=documentation&body=Documentation+under+heading+%22announce_infohash%3A%3A%5Bcomplete_sent%5D%22+could+be+improved">report issue</a>]</span>


complete_sent
	set to true when we send a event=completed.
	


.. raw:: html

	<a name="announce_endpoint"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_endpoint&labels=documentation&body=Documentation+under+heading+%22class+announce_endpoint%22+could+be+improved">report issue</a>]</span>



announce_endpoint
-----------------

Declared in "`libtorrent/announce_entry.hpp`__"


__ include/libtorrent/announce_entry.hpp

announces are sent to each tracker using every listen socket
this class holds information about one listen socket for one tracker




.. parsed-literal::
	

	struct announce_endpoint
	{
	   **announce_endpoint** ();
	
	   tcp::endpoint local_endpoint;
	   aux::array<announce_infohash, num_protocols, protocol_version> info_hashes;
	   bool **enabled**  = true;
	};

.. raw:: html

	<a name="local_endpoint"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Blocal_endpoint%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Blocal_endpoint%5D%22+could+be+improved">report issue</a>]</span>


local_endpoint
	the local endpoint of the listen interface associated with this endpoint
	


.. raw:: html

	<a name="info_hashes"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Binfo_hashes%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Binfo_hashes%5D%22+could+be+improved">report issue</a>]</span>


info_hashes
	info_hashes[0] is the v1 info hash (SHA1)
	info_hashes[1] is the v2 info hash (truncated SHA-256)
	


.. raw:: html

	<a name="enabled"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_endpoint%3A%3A%5Benabled%5D&labels=documentation&body=Documentation+under+heading+%22announce_endpoint%3A%3A%5Benabled%5D%22+could+be+improved">report issue</a>]</span>


enabled
	set to false to not announce from this endpoint
	


.. raw:: html

	<a name="announce_entry"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:class+announce_entry&labels=documentation&body=Documentation+under+heading+%22class+announce_entry%22+could+be+improved">report issue</a>]</span>



announce_entry
--------------

Declared in "`libtorrent/announce_entry.hpp`__"


__ include/libtorrent/announce_entry.hpp

this class holds information about one bittorrent tracker, as it
relates to a specific torrent.




.. parsed-literal::
	

	struct announce_entry
	{
	   explicit **announce_entry** (string\_view u);
	   announce_entry& **operator=** (announce\_entry const&) &;
	   **announce_entry** (announce\_entry const&);
	   **~announce_entry** ();
	   **announce_entry** ();
	
	   enum tracker_source
	   {
	      source_torrent,
	      source_client,
	      source_magnet_link,
	      source_tex,
	   };
	
	   std::string url;
	   std::string trackerid;
	   std::vector<announce_endpoint> endpoints;
	   std::uint8_t **tier**  = 0;
	   std::uint8_t **fail_limit**  = 0;
	   std::uint8_t source:4;
	   bool verified:1;
	};

.. raw:: html

	<a name="~announce_entry()"></a>
	<a name="operator=()"></a>
	<a name="announce_entry()"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5B~announce_entry%28%29+operator%3D%28%29+announce_entry%28%29%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5B~announce_entry%28%29+operator%3D%28%29+announce_entry%28%29%5D%22+could+be+improved">report issue</a>]</span>



~announce_entry() operator=() announce_entry()
..............................................

.. parsed-literal::
	
	explicit **announce_entry** (string\_view u);
	announce_entry& **operator=** (announce\_entry const&) &;
	**announce_entry** (announce\_entry const&);
	**~announce_entry** ();
	**announce_entry** ();
	

constructs a tracker announce `entry`__ with ``u`` as the URL.


__ reference-Bencoding.html#entry

.. raw:: html

	<a name="tracker_source"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:enum+tracker_source&labels=documentation&body=Documentation+under+heading+%22enum+tracker_source%22+could+be+improved">report issue</a>]</span>



enum tracker_source
...................

Declared in "`libtorrent/announce_entry.hpp`__"


__ include/libtorrent/announce_entry.hpp

+--------------------+-------+---------------------------------------------------------------------------+
| name               | value | description                                                               |
+====================+=======+===========================================================================+
| source_torrent     | 1     | the tracker was part of the .torrent file                                 |
|                    |       |                                                                           |
+--------------------+-------+---------------------------------------------------------------------------+
| source_client      | 2     | the tracker was added programmatically via the `add_tracker()`__ function |
|                    |       |                                                                           |
+--------------------+-------+---------------------------------------------------------------------------+
| source_magnet_link | 4     | the tracker was part of a magnet link                                     |
|                    |       |                                                                           |
+--------------------+-------+---------------------------------------------------------------------------+
| source_tex         | 8     | the tracker was received from the swarm via tracker exchange              |
|                    |       |                                                                           |
+--------------------+-------+---------------------------------------------------------------------------+


__ reference-Torrent_Info.html#add_tracker()

.. raw:: html

	<a name="url"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Burl%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Burl%5D%22+could+be+improved">report issue</a>]</span>


url
	tracker URL as it appeared in the torrent file
	


.. raw:: html

	<a name="trackerid"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btrackerid%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btrackerid%5D%22+could+be+improved">report issue</a>]</span>


trackerid
	the current ``&trackerid=`` argument passed to the tracker.
	this is optional and is normally empty (in which case no
	trackerid is sent).
	


.. raw:: html

	<a name="endpoints"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bendpoints%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bendpoints%5D%22+could+be+improved">report issue</a>]</span>


endpoints
	each local listen socket (endpoint) will announce to the tracker. This
	list contains state per endpoint.
	


.. raw:: html

	<a name="tier"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Btier%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Btier%5D%22+could+be+improved">report issue</a>]</span>


tier
	the tier this tracker belongs to
	


.. raw:: html

	<a name="fail_limit"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bfail_limit%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bfail_limit%5D%22+could+be+improved">report issue</a>]</span>


fail_limit
	the max number of failures to announce to this tracker in
	a row, before this tracker is not used anymore. 0 means unlimited
	


.. raw:: html

	<a name="source"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bsource%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bsource%5D%22+could+be+improved">report issue</a>]</span>


source
	a bitmask specifying which sources we got this tracker from.
	


.. raw:: html

	<a name="verified"></a>

.. raw:: html

	<span class="report-issue">[<a href="http://github.com/arvidn/libtorrent/issues/new?title=docs:announce_entry%3A%3A%5Bverified%5D&labels=documentation&body=Documentation+under+heading+%22announce_entry%3A%3A%5Bverified%5D%22+could+be+improved">report issue</a>]</span>


verified
	set to true the first time we receive a valid response
	from this tracker.
	




.. _`BEP 3`: https://www.bittorrent.org/beps/bep_0003.html
.. _`BEP 17`: https://www.bittorrent.org/beps/bep_0017.html
.. _extensions: manual-ref.html#extensions
.. _`BEP 52`: https://www.bittorrent.org/beps/bep_0052.html
.. _`BEP 19`: https://www.bittorrent.org/beps/bep_0019.html
.. _`BEP 38`: https://www.bittorrent.org/beps/bep_0038.html
.. _`rate based choking`: manual-ref.html#rate-based-choking
.. _`BEP 42`: https://www.bittorrent.org/beps/bep_0042.html
