I am trying to use twisted to build an application that can act as server as well as client at the same time.
I need this application to send and receive messages back and forth between two of its instances.
I used the reactor.run() to start listen and connectTCP. My problem is that I need to run server or client module from other program. Moreover, I cannot put the calling module on hold because reactor.run() stops every other execution of your code. To make it work, I started the reactor.run in a separate thread with installSignalHanlder=0.
I have got the success to transfer messages between two instances if one is acting as server and other as client. However, I could not send messages if both instances started as servers and then start sending the messages to each other. I tried to google around but could not find the solution. Can you help me in this?
I can not start server as independent module. I have to start it from other python script that will use my module to act as server as well as client to send and receive the messages.