用于编写 P2P 应用程序的 Python 库/框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/963305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 21:10:01  来源:igfitidea点击:

Python Library/Framework for writing P2P applications

pythonnetworkingp2pjxta

提问by Manuel Ceron

Is there any library or framework for writing P2P applications in Python ?

是否有用于在 Python 中编写 P2P 应用程序的库或框架?

I know the initial Bittorrent client was written in Python. I'm looking something like JXTAbut for Python.

我知道最初的 Bittorrent 客户端是用 Python 编写的。我正在寻找类似JXTA 的东西,但适用于 Python。

回答by Vitorio

Twisted is pretty much the answer to anything seriously network-related in Python, but you really have to buy into the Twisted way of doing things. It's not intrinsically a P2P stack, it's an event loop, callback system and networking framework.

Twisted 几乎是 Python 中任何与网络相关的严重问题的答案,但您确实必须接受 Twisted 的做事方式。它本质上不是 P2P 堆栈,而是一个事件循环、回调系统和网络框架。

Divmod Vertex is not currently being maintained, and was still pretty rough when I tried using it a few years ago.

Divmod Vertex 目前没有维护,几年前我尝试使用它时仍然很粗糙。

CSpacemight be the closest to what you're looking for: "a platform for secure, decentralized, user-to-user communication over the internet." It abstracts the P2P and NAT traversal out so your app can act normally and not be "a P2P app."

CSpace可能最接近您要找的东西:“一个通过互联网进行安全、分散、用户到用户通信的平台。” 它抽象了 P2P 和 NAT 遍历,因此您的应用程序可以正常运行,而不是“P2P 应用程序”。

Similarly, there was an old P2P system out of Australia called "The Circle" a few years ago, written entirely in Python, which had secure P2P messaging, chat, file sharing and other features. 0.41c was the last version: http://savannah.nongnu.org/projects/circle/

同样,几年前澳大利亚有一个旧的 P2P 系统,名为“The Circle”,完全用 Python 编写,具有安全的 P2P 消息传递、聊天、文件共享等功能。0.41c 是最后一个版本:http://savannah.nongnu.org/projects/circle/

Also from my bookmarks:

也来自我的书签:

http://entangled.sourceforge.net/is Entangled, "a distributed hash table (DHT) based on Kademlia, as well as a peer-to-peer tuple space implementation."

http://entangled.sourceforge.net/是 Entangled,“基于 Kademlia 的分布式哈希表 (DHT),以及点对点元组空间实现。”

http://khashmir.sourceforge.net/is a Python distributed hash table, notable because it networks using the Airhook protocol, which is very fault-tolerant (designed for use e.g. over cellular networks).

http://khashmir.sourceforge.net/是一个 Python 分布式哈希表,值得注意的是它使用 Airhook 协议进行网络连接,该协议非常容错(设计用于例如蜂窝网络)。

http://kenosis.sourceforge.net/is a Python P2P RPC system.

http://kenosis.sourceforge.net/是一个 Python P2P RPC 系统。

回答by nosklo

Best option I can think, of course, is to use twisted.

我能想到的最佳选择当然是使用twisted

Old version of BitTorrentwas built with it. The link is to last known version that uses twisted. You can study that as a starting point.

旧版本的 BitTorrent就是用它构建的。该链接指向使用扭曲的最后一个已知版本。您可以将其作为起点进行研究。

There's also Vertex. It is a library that uses twisted and allows p2p with firewall bypassing.

还有Vertex。它是一个使用 Twisted 并允许 p2p 绕过防火墙的库。

回答by Travis Hoogendoorn

Since this question was asked and subsequently answered, ZeroMQhas emerged, and I REALLY like it. The Python module is called pyzmq. It makes the process building TCP sockets way less clunky, especially when dealing with message patterns other than Request>Respond, though it does that as well. It's great for basic servers, p2p apps, messaging, distributed processing, you name it.

自从提出这个问题并随后回答了这个问题,ZeroMQ就出现了,我真的很喜欢它。Python 模块称为 pyzmq。它使构建 TCP 套接字的过程不那么笨拙,尤其是在处理请求>响应以外的消息模式时,尽管它也这样做。它非常适合基本服务器、p2p 应用程序、消息传递、分布式处理,应有尽有。

回答by Vinko Vrsalovic

I don't know if such a thing exists, though I can offer the following alternatives:

我不知道是否存在这样的事情,但我可以提供以下替代方案:

回答by nik

I quote from the Sun JXTA pageswhich have a December 2002 date,

我引用日期为 2002 年 12 月的 Sun JXTA 页面

"Project JXTA has a Java reference implementation available from download.jxta.org, and is currently working to add reference implementations in other common languages, including C, Objective C, Perl, Ruby, and Python. Though the Java implementation is the most complete implementation of the JXTA protocols, the C implementation (available for both Win32 and Linux) is fast approaching the same level of completeness."

“JXTA 项目有一个 Java 参考实现,可从 download.jxta.org 获得,目前正在努力添加其他常用语言的参考实现,包括 C、Objective C、Perl、Ruby 和 Python。虽然 Java 实现是最完整的JXTA 协议的实现,C 实现(可用于 Win32 和 Linux)正在快速接近相同级别的完整性。”

回答by Jér?me Verstrynge

Hi (from the leader of the two last releases of JXTA for Java 2.6 & 2.7),

嗨(来自 Java 2.6 和 2.7 的最后两个 JXTA 版本的领导者),

There is no known implementation of JXTA in Python.

在 Python 中没有已知的 JXTA 实现。

If anyone wants to tackle this issue, one should learn about the JXTA 2.0 protocols first. The Practical JXTA II book available online for reading at Scribd should help understanding the technology.

如果有人想解决这个问题,首先应该了解 JXTA 2.0 协议。可在 Scribd 在线阅读的实用 JXTA II 书籍应该有助于理解该技术。

Cheer!

欢呼!

回答by anthony

Stackless Pythonmight be of interest to you.

您可能对Stackless Python感兴趣。