gpt4 book ai didi

python - 为什么我无法使用 Kademlia 示例代码设置值?

转载 作者:太空宇宙 更新时间:2023-11-03 17:58:41 25 4
gpt4 key购买 nike

我想在我的项目中使用 DHT,但在获取 Kademlia example 时遇到问题工作。

这是来自 twistd -noy Examples/server.tac 的输出日志:

2015-01-21 18:19:43+0100 [-] Log opened.
2015-01-21 18:19:43+0100 [-] twistd 13.2.0 (/usr/bin/python 2.7.6) starting up.
2015-01-21 18:19:43+0100 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2015-01-21 18:19:43+0100 [-] KademliaProtocol starting on 8468
2015-01-21 18:19:49+0100 [-] 'Did not received reply for msg id YES6sdvjJ3qpg5Pr6pg/ajdeMg8= within 5 seconds'
2015-01-21 18:19:49+0100 [NodeSpiderCrawl] [INFO] creating spider with peers: []
2015-01-21 18:19:49+0100 [NodeSpiderCrawl] [INFO] crawling with nearest: ()
2015-01-21 18:19:49+0100 [NodeSpiderCrawl] [INFO] last iteration same as current - checking all in list now
2015-01-21 18:19:53+0100 [Server] [WARNING] No known neighbors, so not writing to cache.

这是上面链接中找到的客户端脚本的输出:

2015-01-21 18:22:09+0100 [-] Log opened.
2015-01-21 18:22:09+0100 [-] KademliaProtocol starting on 5678
2015-01-21 18:22:14+0100 [-] 'Did not received reply for msg id SpQjdpv2Qos+C7q0BB1XzNgya4A= within 5 seconds'
2015-01-21 18:22:14+0100 [NodeSpiderCrawl] [INFO] creating spider with peers: []
2015-01-21 18:22:14+0100 [NodeSpiderCrawl] [INFO] crawling with nearest: ()
2015-01-21 18:22:14+0100 [NodeSpiderCrawl] [INFO] last iteration same as current - checking all in list now
2015-01-21 18:22:14+0100 [-] Found nodes: []
2015-01-21 18:22:14+0100 [Server] [DEBUG] setting 'a key' = 'a value' on network
2015-01-21 18:22:14+0100 [Server] [WARNING] There are no known neighbors to set key a key
2015-01-21 18:22:14+0100 [Server] [WARNING] There are no known neighbors to get key a key
2015-01-21 18:22:14+0100 [-] Key result: None
2015-01-21 18:22:14+0100 [KademliaProtocol (UDP)] (UDP Port 5678 Closed)
2015-01-21 18:22:14+0100 [-] Main loop terminated.

发生什么事了?我知道对等点需要网络才能连接,但这不是独立服务器应该做的事情吗?

提前致谢!

最佳答案

README 文件中客户端代码的引导地址不正确。存储库中的示例文件 exmaple.py有正确的线路。

请换行:

server.bootstrap([('127.0.0.1', 1234)]).addCallback(done, server)

server.bootstrap([('127.0.0.1', 8468)]).addCallback(done, server)

关于python - 为什么我无法使用 Kademlia 示例代码设置值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28073211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com