How do you build a Request-Response service using Asyncore in Python?

Posted by Casey on Stack Overflow See other posts from Stack Overflow or by Casey
Published on 2010-04-13T01:55:31Z Indexed on 2010/04/13 2:02 UTC
Read the original article Hit count: 404

Filed under:
|
|

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:

  1. Use the loop,timeout parameters of asyncore.loop() to allow my client program time to send the appropriate request.

  2. 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.

© Stack Overflow or respective owner

Related posts about python

Related posts about asyncore