关于解析Tracker服务器回应peers300字段,和关于网络字节顺序是什么

大魔大天王 发布于 2020/03/04 10:18
阅读 52
收藏 0

这两天在研究bt种子下载但是 在请求Tracker服务器的时候,服务器给我返回了这么个数据

d8:completei1331e10:downloadedi69369e10:incompletei31e8:intervali1886e12:min intervali943e5:peers300:�bB�ʛT�J|ἳY�ٴm$��_�G�G�H�`՘��d��ZN��k�lC��S�Q���3�6�A��q(�P���/A@X�ٺ��Q�&�2�Ѵ���O����sE!�FW����/�7��;��W��,�O\"�S��E?��3�Q�����W�����?���ki;V��:��՞����2W��|�NH�E��%��Z���@���uf��#'U�J��D%!��$�_�A��rv��HT�R�H�'O����N�F�ZJfZ����G,�xmɚ��bP�6rA�ف�� �%���e

通过解析获取到

{"complete":1333,"downloaded":69369,"incomplete":31,"interval":1664,"min interval":832,"peers":"Xu+/vUjvv73vv73vv71V77+9NO+/ve+/ve+/vUZ277+977+977+9TEJF77+9XCM3Le+/vREr1r8YfFLvv73vv73vv73vv73DgRvvv71g77+977+9LGLvv70dfe+/vTHvv73vv71n77+9We+/ve+/vV5HZe+/ve+/ve+/vU7vv70GM++/vSxDAu+/ve+/vRrvv73RjSE077+91a3vv73vv73vv73vv73vv73vv73vv71e77+977+9VO+/ve+/ve+/ve+/ve+/vTPvv73vv71577+977+9JdGz77+977+977+977+977+977+977+977+977+977+9K0rvv73vv73vv71r77+9fC/vv73vv71hf13vv73vv70MVwdZ77+977+977+9Pgvvv73vv73v"}

然后查询官网说peers是以网络字节顺来进行排序的,问下这个网络字节顺序是什么,然后如何转换成标准的ip加端口

官网是这么说的

compact: Indicates the client accepts a compact response. The peers list is replaced by a peers string with 6 bytes per peer. The first four bytes are the host (in network byte order), the last two bytes are the port (again in network byte order). It should be noted that some trackers only support compact responses (for saving bandwidth) and refuse normal requests.

加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部
返回顶部
顶部