⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http.xml

📁 LibTorrent is a BitTorrent library written in C++ for *nix, with a focus on high performance and goo
💻 XML
字号:
<chapter id="http">  <title>Http handler</title><section id="introduction"><title>Introduction</title><para>LibTorrent depends on the client to handle http downloads, thus thelibrary does not have a dependency on any specific http library. Thelibrary provides a base class named torrent::Http with virtual memberfunctions that the client must implement, and a sigc++ slot which mustbe set to create an instance of the derived torrent::Http class whencalled.  </para><para>The torrent::Http class and the factory slot related functions can befound in the header "torrent/http.h". The http handler should havereasonable connection timeouts, be non-blocking and not do reconnectson failed downloads.</para></section><section id="factory"><title>Factory Slot</title><para>The client registers the desired factory slot with the statictorrent::Http::set_factory member function. Using sigc++ the clientmay bind values to the arguments of their function to avoid dependingon globals. The factory slot must return a pointer to a new instancewith the base type torrent::Http, and the caller takes responsibilityof deleting the object. (Note: consider making the cleanup a slot)</para></section><section id="stream"><title>Output Stream</title><para>The data downloaded by the http handler is to be written totorrent::Http::m_stream which is a pointer to an std::iostream. Thehttp handler must not change any of the flags on the stream.</para></section><section id="start"><title>Start</title><para>Http::start is called by the library when it wishes to initiate a httpdownload. Your Http derived class must implement this function. Itmust be non-blocking and thread-safe. This means that if a seperatethread is used for downloading then it must not emit any signal whilethe main thread is inside the library.</para><section id="close"><title>close</title><para>Http::close is used bu the library to stop and close a download. Nosignals may be emited after this. Http::m_data should not becleared. The library may clear the Http::m_data pointer after this.</para><section id="signals"><title>Signals</title><para>There are two mutually exclusive signals that are called when thedownload has stopped. The signal torrent::Http::m_signalDone is calledif the download was successful and torrent::Http::m_stream containsthe complete data. Or if the download was unsuccessful for somereason, then torrent::Http::m_signalFailed is called with an errormessage.</para></section></chapter>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -