[Twisted-Python] C++ port of Twisted

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Jun 12 05:58:12 EDT 2007


Hello Maarten,

2007/6/12, Maarten ter Huurne wrote:
> On Tuesday 12 June 2007, Amaury Forgeot d'Arc wrote:
>
> > I love python and I find twisted fantastic, but here I have to write a
> > C++ application, for performance pseudo-reasons :-(
>
> It's not an option to write part of the application in C++ and part in Python?

Not yet. Maybe in a few years...

> > I was looking for a Twisted-like framework in C++.
> > Do you know if such a library exists?
>
> Qt is the closest thing I've seen, in the sense that it offers an asynchronous
> API for networking. In the signal-slot mechanism for callbacks, you connect
> two objects semi-permanently, unlike a Deferred which is used just once.

Interesting, a bit like event binding in wxWidgets.

> If the way you handle events is mostly static, it is not a problem.

But it's not really the case. Events may have the same type, but are
needed in different places when the protocol state changes. Deferreds
fit well in this case.

> Qt is modular since 4.0, so you could use the network part without the GUI
> part. But unlike Twisted, it doesn't come with implementations for all
> popular network protocols. For the client side, KIO from KDE supports many
> protocols, for the server side you'd probably have to write it yourself.

Well, both Qt and kio provide basic socket wrappers, but their
protocol frameworks seem completely geared toward filesystems or URLs.

I will use the financial FIX protocol. I am looking for a way to
implement new protocols.

Actually I already developed a bunch of classes that mimic part of the
twisted framework:
Deferreds, Protocols, Connectors, and a Reactor which provides
TcpTransport and callLater().
The reactor implementation is based on Windows MFC classes (and a
reactor based on select is under development)
It's far from complete, but it seems to work.

If someone is interested, I can try to clean up the code and share it...

-- 
Amaury Forgeot d'Arc




More information about the Twisted-Python mailing list