libbt是一个比较简单的,C语言写的Bittorrent的库。更新的速度很慢。
官方网站是:
http://sourceforge.net/projects/libbt 最新的版本是1.06(2007-09-19),之前的一个版本是1.05(2005-12-10)
另外一个网站应该也是。不过似乎停止更新了:
http://libbt.sourceforge.net/编译还是比较简单的,有点小问题,比较快的得到了解决。
./configure
make
如有需要,make clean 清楚一下之前的编译。
报错的地方似乎是两三个:stddef.h stdarg.h size_t
前两个是说在指定的几个lib或者include的地方找不到。
于是我用 find / -name "stddef.h" 把这些文件找到放到它要找的地方就行了。
关于size_t的问题,情况大概是这样的。
报错消息类似是这样(我的报错没有及时保存,用的网页上的。基本上没区别):
i686-pc-linux-gnu-gcc -O2 -march=i686 -pipe -g -Wall -I../include -I../include
-DVERSION=1.05 -g -L. -o btlist btlist.c -lbt -lresolv -luuid -lssl -lcurl
`curl-config --libs` -lm
In file included from btlist.c:16:
/usr/include/openssl/sha.h:109: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:111: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:116: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:118: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:138: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:140: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:142: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:144: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:185: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:187: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:189: error: expected declaration specifiers or '...'
before 'size_t'
/usr/include/openssl/sha.h:191: error: expected declaration specifiers or '...'
before 'size_t'
btlist.c: In function 'main':
btlist.c:106: warning: pointer targets in passing argument 1 of 'SHA1' differ
in signedness
btlist.c:106: warning: passing argument 2 of 'SHA1' makes pointer from integer
without a cast
btlist.c:106: error: too many arguments to function 'SHA1'
make[1]: *** [btlist] Error 1
make[1]: Leaving directory `/var/tmp/portage/libbt-1.05/work/libbt-1.05/src'
make: *** [compile] Error 2
!!! ERROR: net-libs/libbt-1.05 failed.
后来从
http://bugs.gentoo.org/show_bug.cgi?id=152489 找到了答案。
Adding " #include <sys/types.h> " to src/btlist.c solved the problem for both
1.04 and 1.05 on my box.Diff looks like this:
--- libbt-1.04/src/btlist.c 2004-04-18 09:56:26.000000000 +0300
+++ libbt-1.04-fixed/src/btlist.c 2006-11-04 14:39:18.000000000 +0200
@@ -1,5 +1,6 @@
#include "config.h"
+#include <sys/types.h>
#include <openssl/sha.h>
#include <stdlib.h>
#include <string.h>
实际上也就是要加上这么一句在头文件的引用中:
#include <sys/types.h>
然后make clean之后再重新./configure 和 make 就搞定了。
生成了三个可执行文件:btcheck, btlist, btget
使用方式很简单:
就是命令后面跟种子文件名就行了。
比如:
btcheck OpenOffice.torrent 检查种子文件,分块信息
btlist OpenOffice.torrent 列举种子文件内信息,比如文件名,hash值,tracker的url和list之类的。
btget OpenOffice.torrent 最有用的就这个啦,就是下载文件了。时不时的给出peer在列表array中的进入退出情况。
同时给出下载的百分比,等等。。。
给出几个下载中的状态界面,我用它下载了OpenOffice:
中间下载的时候,也许是网络临时断了一下。我也不知道,生成了一个后缀为.fastresume的文件。2个Byte。
文本打开后就两个字母:fc。具体做什么的不太清楚。
1。有peer退出,发送消息(似乎是确认吧,还没仔细看程序)
Peer 85.132.136.165:6881 not found in arrayUpload 0bps
Peer 85.132.136.165:6881 not found in array
Sending message to peer 85.132.136.165:
00000000: 64353a61 64646564 363a5584 88a5e11a 373a6164 |dded6:U?????7:added.|
00000014: 6465642e 66303a65 ........ ........ ........ |f0:e?????...........|
2。有peer加入
Peer 85.132.136.165:6881 found in array at position 0
Sending message to peer 85.132.136.165:
00000000: 64373a61 64646564 2e66303a 65...... ........ |dded.f0:e?????......|
3。时间间隔,以及某个block hash值准备完毕。
Time 1224753594
Time 1224753595
Time 1224753596
hash ok for block 124
Time 1224753597
Time 1224753598
Time 1224753599
4。下载完成时
0x8ae6e78(DICT)={
0x8ae84c8(STRING)=(8)'complete'
=>
0x8ae8318(INTEGER)=4
0x8ae84dc(STRING)=(10)'incomplete'
=>
0x8ae8368(INTEGER)=1
0x8ae84f0(STRING)=(8)'interval'
=>
0x8ae8330(INTEGER)=1800
0x8ae8504(STRING)=(12)'min interval'
=>
0x8ae8418(INTEGER)=1500
0x8ae8518(STRING)=(5)'peers'
=>
0x8ae84a0(STRING)=(0)''
0x8ae852c(STRING)=(7)'private'
=>
0x8ae00d8(INTEGER)=0
}
Tracker notified of complete
Time 1224753811
read: [503] Peer disconnected after repeated errorsbps
6: Read error Peer disconnected after repeated errors
6: Peer 85.132.136.165 shutdown read (Peer disconnected after repeated errors)
Time 1224753812
Time 1224753813
Time 1224753814
Time 1224753815
Time 1224753816
Time 1224753817
Time 1224753818
Time 1224753819
Time 1224753820
Time 1224753821
Time 1224753822
Time 1224753823
Time 1224753824
Time 1224753825
Time 1224753826
Time 1224753827
Time 1224753828
Time 1224753829
Time 1224753830
Time 1224753831
Time 1224753832
Time 1224753833
Writing fast resume data for OOo_3.0.0rc4_20080930_LinuxIntel_install_en-US.tar.gz...done
0x8ae6e78(DICT)={
0x8ae8120(STRING)=(8)'complete'
=>
0x8ae7f90(INTEGER)=5
0
x8ae8134(STRING)=(10)'incomplete'
=>
0x8ae7fc0(INTEGER)=0
0x8ae8148(STRING)=(8)'interval'
=>
0x8ae7fa8(INTEGER)=1800
0x8ae815c(STRING)=(12)'min interval'
=>
0x8ae8070(INTEGER)=1500
0x8ae8170(STRING)=(5)'peers'
=>
0x8ae80f8(STRING)=(0)''
0x8ae8184(STRING)=(7)'private'
=>
0x8ae1680(INTEGER)=0
}
Tracker shutdown complete
[root@localhost LibbtExe]#
分享到:
相关推荐
title: GAMESS2013编译使用简记- 科2014-02-23 21:14:14 初稿2014-03-08 12:09:09 修订编译解压 tar -
英语音标简记法英语音标简记法英语音标简记法英语音标简记法英语音标简记法英语音标简记法
简记个人博客网站源码为博主现有博客网站,前端采用LayUI框架,此分享版本为asp + access。所有功能齐全,欢迎使用。 使用方法:上传至空间或服务器,通过IIS发布网站即可。 演示地址:...
这是群主Earnest为大家出过的习题及答案,第一期共两个题~。
497476974884240简记.apk
高中化学各简记规律.docx
jsp标准语法中7大动作 简记(经典) jsp标准语法中7大动作 简记(经典)
Programming 简记 LP)则是数学规划的一个重要分支。自从 1947 年 G. B. Dantzig 提出 求解线性规划的单纯形方法以来,线性规划在理论上趋向成熟,在实用中日益广泛与深 入。特别是在计算机能处理成千上万个约束条件...
七年级英语音标简记法PPT教案.pptx
简记个人博客网站源码 v2.10.01.rar
考试_上课简记&qq群消息汇总.pdf
高中历史之历史百科简记美国“飞虎队”在云南素材
中考知识要点简记归纳之人教版初一数学知识点总结.pdf
第一章:这是 USACO 的第一篇文章,《杂题》,所谓杂题,广义上讲:就是没有任何套路的题目,通常这种题目使用的是构造法,而模拟策略又居多,文章言简意赅的叙述了
NULL 博文链接:https://joard.iteye.com/blog/403031
NULL 博文链接:https://chengjianxiaoxue.iteye.com/blog/2428561
此篇文字没有包含完成编程任务的所有过程和细节,也就是说可大胆忽略或脑补不清晰或断节之处。这篇文字记录的是 第一次从头到尾构建C程序工程过程中所涉及到的 有助于程序更合理的一些技术或编程规范。...
NULL 博文链接:https://mabei.iteye.com/blog/601424
此篇文字没有包含完成编程任务的所有过程和细节,也就是说可大胆忽略或脑补不清晰或断节之处。这篇文字记录的是 第一次从头到尾构建C程序工程过程中所涉及到的 有助于程序更合理的一些技术或编程规范。...
这题计算磁盘容量 知道柱面个数等条件计算 把课本相关概念看熟就可以综合题:(1)条件:知道是余15码 用12位字长格式 6位是尾数A:0 10010 01101