How do you build a Request-Response service using Asyncore in Python?
- by Casey
I have a 3rd-party protocol module (SNMP) that is built on top of asyncore. The asyncore interface is used to process response messages. What is the proper technique to design a client that generate the request-side of the protocol, while the asyncore main loop is running. I can think of two options right now:
Use the loop,timeout parameters of asyncore.loop() to allow my client program time to send the appropriate request.
Create a client asyncore dispatcher that will be executed in the same asyncore processing loop as the receiver.
What is the best option? I'm working on the 2nd solution, cause the protocol API does not give me direct access to the asyncore parameters. Please correct me if I've misunderstood the proper technique for utilizing asyncore.