In this post, I will explore the framework that implements low level protocol and networking support in twisted. This one for me was really twisted. No wonder, it is named as such!
In retrospection, generality of twisted as a networking framework is greatly improved by the underlying complexity of it's implementation. How ever, tackling this complexity does pay off in the awesome power this tool provides in building networking applications.
I am a picture guy. I can't hold all these dense information without some sort of picture in place. So I guess, I will put the picture first and then delve in the details.
Sorry folks, no code in this post.
+----------------+ connectSSL +-----------+ |PosixReactorBase|.......listentTCP ......|IReactorTCP| +----------------+ connectTCP +-----------+ | | +----------+ | |IConnector|________connector obj <.......You pass a factory +----------+ obj -> connect This is a protocol | | factory. | | ,-' | stopDisconnecting ,-' | getDestination ,' | ..............> factory.dostart() connect..............> _makeTransport() | +-------------+ connection obj |ISystemHandle|________| |__calls factory.buildProtocol(addr) | | | |ITCPTransport|.......>+----------+ | +-------------+ |ITransport| +-------------+ +----------+ |IProtocol obj| | +-------------+ .............:................ | | Client..___ __Server `'`---..----'''' These are initialized differently