- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试向对等点发送 BitTorrent 握手,但它不起作用。有人能弄清楚我做错了什么吗? len
应该返回一些东西,但目前为零。
require 'bencode'
require 'digest/sha1'
file = File.open('./python.torrent').read
info_hash = Digest::SHA1.hexdigest(a['info'].bencode)
# Here's what parsed_response['peers'] returns:
# [{"ip"=>"8.19.35.234", "peer id"=>"-lt0C20-\x90\xE0\xE6\x0E\xD0\x8A\xE5\xA2\xF2b(!",
# "port"=>9898}]
peer_id = parsed_response['peers'].first['peer id']
send_string = "\023BitTorrent protocol\0\0\0\0\0\0\0\0" << info_hash << peer_id
# ip and port are my current internet ip and 6881 respectively
client = TCPSocket.new ip, port
# What I'm sending over
client.send("\023BitTorrent protocol\0\0\0\0\0\0\0\0" << info_hash << peer_id, 0)
len = client.recv(1)
puts len
这是 send_string
最后的样子:
最佳答案
在你身边握手时,使用的 PeerID 应该是你的,而不是对方的。
所以你的消息应该是这样的:
peer_id = "-MY0001-123456654321"
client.send("\023BitTorrent protocol\0\0\0\0\0\0\0\0" << info_hash << peer_id, 0)
如果您正在开发自己的 bit-torrent 客户端,那么您可以按照 bit-torrent 协议(protocol)提到的标准为 peer id 使用自己的格式。您可以在此处阅读有关对等 ID 的更多信息: https://wiki.theory.org/BitTorrentSpecification#peer_id
如果您以后有任何困惑,请启动任何 bittorrent 客户端并关注 wire-shark 数据包。你会明白,你在哪里犯了错误。
这里“-KS0001-123456654321”是我的 bittorrent 客户端的 peerid。
关于ruby - BitTorrent 对等握手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18394049/
我正在考虑使用 bittorrent 解决大型数据传播问题,其中数据源为千万亿级,用户需要高达数 TB 的数据。一些细节 潜在数以百万计的种子数 种子大小从 100Mb 到 100Gb 世界上一组稳定
我阅读了官方文档 here和关于 bittorrent 客户端的维基百科文章 here但找不到跟踪器究竟是如何工作的。根据我的理解,跟踪器应该知道哪个对等方拥有某个文件的哪个片段。例如,客户端 1 有
我第一次使用magnet link 。我很好奇它是如何工作的,因此查阅了规范,但没有找到任何答案。 wiki 表示 xt 表示“精确主题”,后跟带有 SHA1 哈希值的格式(在本例中为 btih)。我
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我的理解是 IPFS 和 Bittorrent Mainline DHT 是建立在分布式哈希表 (Kademlia) 之上的。 他们使用文件哈希作为 Kademlia key 来查找可能具有此文件的对
如果我有两台笔记本电脑并将它们连接到同一个互联网连接,然后使用 BitTorrent 软件下载同一个 torrent 文件,跟踪器会看到什么?以及洪流软件的行为如何? 假设在笔记本电脑 A 中,我开始
如果我有一个没有任何跟踪器的 torrent,并且我刚刚启动了一个 bittorent 客户端,所以我还没有对等点...我如何知道在 DHT 中首先与谁连接?看起来我必须至少知道 DHT 中的一个节点
每次向对等点请求特定文件时,每个对等点是否都成为 DHT 节点?还是节点独立于对等点存在?本质上,你如何成为一个节点?你可以是一个peer而不是一个节点吗? 如果问题太简单(这里是菜鸟),我很抱歉,但
所以下面的请求: torrent.ubuntu.com:6969/announce?info_hash=%02%21%CA%F9j%A3%CB%94%F0%F5%8DE%8Ex%B0%FC4J%D8%
在http://www.bittorrent.org/beps/bep_0005.html ,announce_peer 查询需要一个 token ,该 token 具有 require,“响应先前的
我正在使用TransmissionBT torrent客户端(http://www.transmissionbt.com/)。 是否可以对代码进行简单修改,以便能够以顺序模式(从文件开头)下载文件。这
我有一个关于 torrent 文件的问题。 我知道它包含我需要连接的服务器(用户)列表,用于下载整个文件的一部分。 我的问题是,这是否就是洪流所包含的全部内容?还有更重要的细节吗? 谢谢! 最佳答案
当一个对等体连接到另一个拥有所有片段的对等体时,连接的对等体如何知道它所连接的实际上是一个种子(并且拥有所有片段)?他们之间是否有消息发送? 在像 uTorrent 这样的客户端中,对等点似乎也知道它
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
使用来自的 torrent 文件 http://torrent.ubuntu.com:6969/ 我正在计算与页面上的哈希匹配的哈希。 然后我向跟踪器发出请求。喜欢 http://torrent.ub
BitTorrent 群中的最佳节点数是多少?我认为有一种数学方法可以表达最有效的节点数。老实说,我有一个问题,即只有经验数量的 X,而没有严格的支持。 根据 this specification数字
在我的新周末项目中,我决定从头开始编写一个 bittorrent 客户端,根本没有准备好使用库。经过两天寻找文档,我已经准备放弃 :smile:。我知道有 BEPs , 但他们还远远不足以理解所有规范
当我使用 torrent 下载 ISO 镜像时;我应该仍然验证文件的完整性(例如通过计算 sha256 哈希),还是在下载时自动完成? 最佳答案 BitTorrent 协议(protocol)具有一种
我正在尝试自己实现 bittorent 协议(protocol),但我在使用 C++ 解码跟踪器响应中的“Peers”值时遇到问题。 根据bittorent协议(protocol)文档: peers:
我使用 BitTorrent,有时会遇到没有种子的文件(缺失部分)。 那时,我们有时会强制结束文件传输并尝试打开未完成的文件(例如图像文件)。 如果幸运的话,即使丢失了某些部分,也可能能够看到下载的图
我是一名优秀的程序员,十分优秀!