用于构建 TCP 服务器的好的 Python 网络库? [英] Good Python networking libraries for building a TCP server?

查看:78
本文介绍了用于构建 TCP 服务器的好的 Python 网络库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道有哪些用于 Python 构建 TCP/IP 服务器的网络库.我知道 Twisted 可能会跳到我的脑海中,但文档对我来说似乎稀缺、草率且零散.

I was just wondering what network libraries there are out there for Python for building a TCP/IP server. I know that Twisted might jump to mind but the documentation seems scarce, sloppy, and scattered to me.

此外,使用 Twisted 甚至比使用 select.select() 滚动我自己的服务器有好处吗?

Also, would using Twisted even have a benefit over rolling my own server with select.select()?

推荐答案

我必须同意文档有点简洁,但教程可以让您快速上手.

I must agree that the documentation is a bit terse but the tutorial gets you up and running quickly.

http://twistedmatrix.com/projects/core/documentation/howto/tutorial/index.html

基于事件的 Twisted 编程范式和它的延迟在开始时可能有点奇怪(对我来说)但值得学习.

The event-based programming paradigm of Twisted and it's defereds might be a bit weird at the start (was for me) but it is worth the learning curve.

与编写自己的框架相比,您可以更快地启动并运行更复杂的东西,而且这也意味着少了一件寻找 bug 的事情,因为 Twisted 已经在生产环境中得到了充分的验证.

You'll get up and running doing much more complex stuff more quickly than if you were to write your own framework and it would also mean one less thing to bug hunt as Twisted is very much production proven.

我真的不知道还有什么框架可以提供与 Twisted 一样多的功能,所以我的投票肯定会投给 Twisted,即使这些文档不适合胆小的人.

I don't really know of another framework that can offer as much as Twisted can, so my vote would definitely go for Twisted even if the docs aren't for the faint of heart.

我同意 Greg 的观点,即 SocketServer 是一个不错的中间立场,但是根据您的应用程序的目标受众及其设计,您可能会在 Twisted 中期待一些不错的东西(想到非常有用的 PerspectiveBroker- http://twistedmatrix.com/projects/core/documentation/howto/pb-intro.html)

I agree with Greg that SocketServer is a nice middle ground but depending on the target audience of your application and the design of it you might have some nice stuff to look forward to in Twisted (the PerspectiveBroker which is very useful comes to mind - http://twistedmatrix.com/projects/core/documentation/howto/pb-intro.html)

这篇关于用于构建 TCP 服务器的好的 Python 网络库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆