Linux BitTorrent客户端设计与实现[含源码]
互联网络通信方式的在不断变迁,它历尽了从最初的同构互连到服务器/客户端格局的通信模式,最终回归到P2P通信模式。
在本人接触到这个课题前,本人对Linux系统知之甚少,最多也只是在课上看老师使用过。自从本人去年选了这个课题后,便开始去图书馆找寻书籍,去网上搜寻相关资料,以及开始去尝试使用这个系统,发现并未如想象之中的那么难。关于本课题,从起初的发展现状到开发所用到的相关技术的介绍,从涉及的专业术语到相关的核心算法的介绍,最后还详细的描述了BT的八个大模块的设计与实现。 F00006
关键字: P2P BitTorrent Linux 查看完整请+Q:351916072获取
The Design and Implementation of a BT Client for Linux
Abstract:In the ever-changing network of communication, which have gone through from the initial interconnection isomorphic to the server / client communication mode pattern and eventually return to the P2P communication mode.
Before I come into contact with this subject, I know little of the Linux system, most only used in the classroom watching the teacher. I chose this topic since last year, I started going to the library to find books, go online to search for relevant information, and began to try to use this system and found it hard to imagine not, as among. About this issue, from the beginning to the current development introduces the development of related technologies are used, from the jargon involved to introduce the relevant core algorithm, and finally a detailed description of the design and implementation of BT's eight large modules.
Keywords: P2P;BitTorrent;Linux
目录
1. 绪论 5
1.1 BitTorrent 发展现状 5
1.2论文主要内容 5
2. 开发技术 6
2. 1 P2P技术概述 6
2. 2 BitTorrent系统中的术语 6
3. BitTorrent内容分发系统相关研究 8
3.1 BitTorrent系统简介 8
3.2 BitTorrent协议分析 9
3.3 BitTorrent系统的核心算法与策略 9
4. Linux下BT客户端的总体设计 11
4.1 系统分析 11
4.2 总体设计 11
4.3 BT客户端的模块化设计 12
5. 模块的设计与实现 14
5.1 种子解析模块的设计和实现 14
5.2 位图管理模块的设计和实现 15
5.3 Peer管理模块的设计和实现 16
5.4 消息处理模块的设计和实现 16
5.5 缓冲管理模块的设计和实现 17
5.6 策略管理模块的设计和实现 18
5.7 连接Tracker模块的设计和实现 18
5.8 与Peer交换数据模块的设计和实现 19
5.9 主函数的设计和实现 19
6. BT系统界面 21
6.1 BT客户端的主界面图 21
6.2 BT客户端的下载界面图 22
7. 结论 24
参考文献: 25
致 谢 26
5.2 位图管理模块的设计和实现
位图是用来区分文件片段的。此模块通过使用二进制里用到的0和1来区分文件片段的状态。连接点和握手后,客户端立即哪块已经下载到节点发送一个位图,并利用节点结构体存储每次回发时的位图。
实际上在虚拟网络上,文件会被等分成一个个片,这些片之后会再次被等分成一个个块。这一个个的块便表示位图。当位图显示的变化时,也表示这一个个的块或者片正在被下载或者上传。
5.3 Peer管理模块的设计和实现
此模块的是由peer创建的结构体构成。此模块在程序中的作用是管理客户端链表,除此之外,还负责客户端节点的增添和删去等
5.4消息处理模块的设计和实现
消息处理模块是对了应对系统遇到消息而存在的,即处理客户端之间交互的消息。根据生成的模块发送消息的当前状态,该模块还负责客户端间消息的处理,客户端根据其状态决定是否响应消息。一旦一个片被正确下载完成时,这个片的获得会以have消息发送给每一个客户端,如果同伴没有这件可以申请将数据发送到对等。
5.5 缓冲管理模块的设计和实现
此为缓冲管理模块,从技术上来说,数据缓存列表对于缓冲模块的完成意义深远。此模块是为了处理或者说是延长硬盘的寿命诞生的。以前那种客户端每次得到一个片后就将其读入,这样很容易将磁盘损毁。
6.1 BT客户端的主界面图:
6.2 BT客户端的下载界面图:查看完整请+Q:351916072获取
在本人接触到这个课题前,本人对Linux系统知之甚少,最多也只是在课上看老师使用过。自从本人去年选了这个课题后,便开始去图书馆找寻书籍,去网上搜寻相关资料,以及开始去尝试使用这个系统,发现并未如想象之中的那么难。关于本课题,从起初的发展现状到开发所用到的相关技术的介绍,从涉及的专业术语到相关的核心算法的介绍,最后还详细的描述了BT的八个大模块的设计与实现。 F00006
关键字: P2P BitTorrent Linux 查看完整请+Q:351916072获取
The Design and Implementation of a BT Client for Linux
Abstract:In the ever-changing network of communication, which have gone through from the initial interconnection isomorphic to the server / client communication mode pattern and eventually return to the P2P communication mode.
Before I come into contact with this subject, I know little of the Linux system, most only used in the classroom watching the teacher. I chose this topic since last year, I started going to the library to find books, go online to search for relevant information, and began to try to use this system and found it hard to imagine not, as among. About this issue, from the beginning to the current development introduces the development of related technologies are used, from the jargon involved to introduce the relevant core algorithm, and finally a detailed description of the design and implementation of BT's eight large modules.
Keywords: P2P;BitTorrent;Linux
目录
1. 绪论 5
1.1 BitTorrent 发展现状 5
1.2论文主要内容 5
2. 开发技术 6
2. 1 P2P技术概述 6
2. 2 BitTorrent系统中的术语 6
3. BitTorrent内容分发系统相关研究 8
3.1 BitTorrent系统简介 8
3.2 BitTorrent协议分析 9
3.3 BitTorrent系统的核心算法与策略 9
4. Linux下BT客户端的总体设计 11
4.1 系统分析 11
4.2 总体设计 11
4.3 BT客户端的模块化设计 12
5. 模块的设计与实现 14
5.1 种子解析模块的设计和实现 14
5.2 位图管理模块的设计和实现 15
5.3 Peer管理模块的设计和实现 16
5.4 消息处理模块的设计和实现 16
5.5 缓冲管理模块的设计和实现 17
5.6 策略管理模块的设计和实现 18
5.7 连接Tracker模块的设计和实现 18
5.8 与Peer交换数据模块的设计和实现 19
5.9 主函数的设计和实现 19
6. BT系统界面 21
6.1 BT客户端的主界面图 21
6.2 BT客户端的下载界面图 22
7. 结论 24
参考文献: 25
致 谢 26
5.2 位图管理模块的设计和实现
位图是用来区分文件片段的。此模块通过使用二进制里用到的0和1来区分文件片段的状态。连接点和握手后,客户端立即哪块已经下载到节点发送一个位图,并利用节点结构体存储每次回发时的位图。
实际上在虚拟网络上,文件会被等分成一个个片,这些片之后会再次被等分成一个个块。这一个个的块便表示位图。当位图显示的变化时,也表示这一个个的块或者片正在被下载或者上传。
5.3 Peer管理模块的设计和实现
此模块的是由peer创建的结构体构成。此模块在程序中的作用是管理客户端链表,除此之外,还负责客户端节点的增添和删去等
5.4消息处理模块的设计和实现
消息处理模块是对了应对系统遇到消息而存在的,即处理客户端之间交互的消息。根据生成的模块发送消息的当前状态,该模块还负责客户端间消息的处理,客户端根据其状态决定是否响应消息。一旦一个片被正确下载完成时,这个片的获得会以have消息发送给每一个客户端,如果同伴没有这件可以申请将数据发送到对等。
5.5 缓冲管理模块的设计和实现
此为缓冲管理模块,从技术上来说,数据缓存列表对于缓冲模块的完成意义深远。此模块是为了处理或者说是延长硬盘的寿命诞生的。以前那种客户端每次得到一个片后就将其读入,这样很容易将磁盘损毁。
6.1 BT客户端的主界面图:
6.2 BT客户端的下载界面图:查看完整请+Q:351916072获取
版权保护: 本文由 hbsrm.com编辑,转载请保留链接: www.hbsrm.com/jsj/rjgc/2076.html