Twisted - how to create multi protocol process and send the data between the protocols

Posted by SpankMe on Stack Overflow See other posts from Stack Overflow or by SpankMe
Published on 2010-03-26T18:08:28Z Indexed on 2010/03/26 18:13 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

Hey,

Im trying to write a program that would be listening for data (simple text messages) on some port (say tcp 6666) and then pass them to one or more different protocols - irc, xmpp and so on. I've tried many approaches and digged the Internet, but I cant find easy and working solution for such task.

The code I am currently fighting with is here: http://pastebin.com/ri7caXih

I would like to know how to from object like:

ircf = ircFactory('asdfasdf', '#asdf666')

get access to self protocol methods, because this:

self.protocol.dupa1(msg)

returns error about self not being passed to active protocol object. Or maybe there is other, better, easier and more kosher way to create single reactor with multiple protocols and have actions triggeres when a message arrives on any of them, and then pass that message to other protocols for handling/processing/sending?

Any help will be highly appreciated!

© Stack Overflow or respective owner

Related posts about python

Related posts about twisted