我在 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/