Python (Twisted) - reading from fifo and sending read data to multiple protocols

Posted by SpankMe on Stack Overflow See other posts from Stack Overflow or by SpankMe
Published on 2010-03-19T09:45:17Z Indexed on 2010/03/19 14:31 UTC
Read the original article Hit count: 617

Filed under:
|
|
|
|

Hi,

Im trying to write some kind of multi protocol bot (jabber/irc) that would read messages from fifo file (one liners mostly) and then send them to irc channel and jabber contacts. So far, I managed to create two factories to connect to jabber and irc, and they seem to be working.

However, I've problem with reading the fifo file - I have no idea how to read it in a loop (open file, read line, close file, jump to open file and so on) outside of reactor loop to get the data I need to send, and then get that data to reactor loop for sending in both protocols. I've been looking for information on how to do it in best way, but Im totally lost in the dark. Any suggestion/help would be highly appreciated.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about python

Related posts about twisted