用于构建 TCP 服务器的好的 Python 网络库?

编程入门 行业动态 更新时间:2024-10-18 08:36:40
本文介绍了用于构建 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.

twistedmatrix/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- twistedmatrix/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 - twistedmatrix/projects/core/documentation/howto/pb-intro.html)

更多推荐

用于构建 TCP 服务器的好的 Python 网络库?

本文发布于:2023-11-15 21:30:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598118.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   网络   TCP   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!