python中的网络应用程序和GUI [英] networking application and GUI in python

查看:65
本文介绍了python中的网络应用程序和GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个通过网络发送文件的应用程序,我想开发一个自定义协议,在功能丰富性方面不限制自己(http 不合适,最接近的可能是 bittorrent 协议).

I'm writing an application that sends files over network, I want to develop a custom protocol to not limit myself in term on feature richness (http wouldn't be appropriate, the nearest thing is the bittorrent protocol maybe).

我尝试过使用twisted,我已经构建了一个很好的应用程序,但是twisted 中有一个错误导致我的GUI 阻塞,所以我必须切换到另一个框架/策略.

I've tried with twisted, I've built a good app but there's a bug in twisted that makes my GUI blocking, so I've to switch to another framework/strategy.

你有什么建议?使用原始套接字和使用gtk mainloop(工具包中有类似select的功能)是不是太难了?

What do you suggest? Using raw sockets and using gtk mainloop (there are select-like functions in the toolkit) is too much difficult?

在不同线程中运行两个主循环是否可行?

It's viable running two mainloops in different threads?

寻求建议

推荐答案

免责声明:我对网络应用程序的经验很少.

Disclaimer: I have little experience with network applications.

话虽如此,原始套接字并不难理解/使用,特别是如果您不太担心优化的话.当然,这需要更多的思考.但是使用 GTK 和原始套接字应该相当简单.特别是因为您使用了扭曲的框架,IIRC 只是抽象了套接字管理的一些更本质的细节.

That being said, the raw sockets isn't terribly difficult to wrap your head around/use, especially if you're not too worried about optimization. That takes more thought, of course. But using GTK and raw sockets should be fairly straightforward. Especially since you've used the twisted framework, which IIRC, just abstracts some of the more nitty-gritty details of socket managing.

这篇关于python中的网络应用程序和GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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