java - Bittorrent 协议(protocol)中的 KeepAlive 消息

标签 java bittorrent

我在 Internet 上的任何地方都找不到这个问题的答案。我想知道当您收到关于 bittorrent 协议(protocol)的保持 Activity 消息时会发生什么?我们应该发回保持 Activity 消息吗?

最佳答案

来自Unofficial BitTorrent Specification :

keep-alive: <len=0000>

The keep-alive message is a message with zero bytes, specified with the length prefix set to zero. There is no message ID and no payload. Peers may close a connection if they receive no messages (keep-alive or any other message) for a certain period of time, so a keep-alive message must be sent to maintain the connection alive if no command have been sent for a given amount of time. This amount of time is generally two minutes.

我不是 BitTorrent 专家,但基于此以及我确实拥有的网络协议(protocol)知识,这听起来像是您问题的答案

are we suppose to send a keep alive message back?

没有。至于

what happens when you receive a keep alive message?

好吧,没什么 — 重要的是当您在提到的“给定时间量”后没有收到保持 Activity (或任何其他)消息时会发生什么。在 BitTorrent 实现中,接收保持 Activity 消息可能会重置计时器,或更新“收到的最后一条消息”时间戳。

关于java - Bittorrent 协议(protocol)中的 KeepAlive 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10392970/

相关文章:

java - 尽管电子邮件和密码的真实值无法使用 mysql 登录

用于 Bittorrent 跟踪器连接的 Java NIO 与 Thread

Java 反射 : Get Classes but not SubTypes

java - 交叉同步块(synchronized block)

bittorrent - 对等点如何知道另一个对等点是种子?

bittorrent - bittorrent 跟踪器如何工作?

c - 为什么我从对等方接收到的数据与预期输出不匹配?

bittorrent - bittorrent 节点可以处理大量空闲种子的种子吗

java - 用手指画画

java - servlet 中的 httpClient post 调用失败,错误为 java.lang.NoSuchMethodError :