I want to achieve this kind of functionality with twisted but I cant seem to get it:
Desired steps are:
LOOP
1. wait until a special message
2. send a message to server
3. handle the responce (if it is a special message exit the loop and call reactor.stop())
END LOOP
I just cant achive simple functionality of sending data on demand with twisted. Instead it seems I have to know all the messages I want to send in advance. Any solution to this?
Sure, there's a solution, but what it is depends on exactly what your problem is. By which I mean: it's not clear why you think you have to know the messages you want to send in advance.
Twisted is a pretty classical async event-based, callback-controlled framework; everything is done "on demand" in response to some other event.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.