Continue BT research - Second part about Tracker in BT

xiaoxiao2021-03-06  39

Continue BT research - Second part About Tracker on BT On the study of BT, the study of the static file structure of the BT file is the structure of the .torrent file. Today, I also read the libbt code and debug the btlist. After two days, I saw the documentation of BT transmission, and I started to track the code of the BT transmission part and make a record. (1) About the server BT server with BT mainly has the following elements (1) The server is running a Tracker (2) Run a web server (3) to do the .torrent files (4) Generate a valid seed Document (5) put the seed file onto the web page (2) Tracker on the BT is the essence of BT, is the soul of BT technology. When establishing a connection, Tracker collects information from all downloaders and helps them random random Pairing, this a bit like P2P's punch server, through this stuff to help downloaders build TCP-based channels, all the processes are based on HTTP protocols. All Downloaders use periodic with Tracker to report their progress and information, upload and download their data through different connections, and the connection is TCP connection, applying the BitTorrent Peer Protocol (3) Analysis of BT Codes The code mainly wants to look at the Btget.c, because this function library has used two third-party open source libraries, so I want to know that I don't know how Libcurl and OpenSSL are two projects. ctx_register (ctx, dl); which a code is taken tracker file int ctx_register (struct btContext * ctx, unsigned download) / * * Contact the tracker and update it on our status Also * add any new peers that the tracker reports back. To us. * / {btdownload * DL = CTX-> Downloads [Download]; btobject * Resp; assert (Download downloadcount); / * contact tracker * / respon = btrequest (dl-> url, ctx-> MyID, CTX-> MyKey, DL-> Infohash, CTX-> Listenport, DL-> FileSet.dl, DL-> FileSet.ul * CTX-> Ulfactor, DL-> FileSet.Left, "Started"); if ( ! resp) Return -Eagain; #if 0 btobject_dump (0, resp); #ENDIF BTRESPONSE (CTX, Download, ResP); btobject_destroy (Res); Return 0;} Some of the tags to make TRAKER The code, this function is used by the function of the libcurl library, the MAIN function has a loop code should be part of the transmission and reception of the data. I will remember it today, continue tomorrow.

转载请注明原文地址:https://www.9cbs.com/read-61535.html

New Post(0)