[Twisted-web] Reactor events help request ..
David.Watson at windriver.com
Tue Feb 23 20:12:12 EST 2010
Hi Folks ..
I'm not entirely a newbie a python and twisted, but I have come to the
point where I need a bit more expertise on this topic, so I am hoping
that I have come to the right place ..
What I'm hoping, that you folks can help out with a minor problem that
I am having with the twistd reactor class and/or the callLater function
I have been using a reactor.callLater function to schedule an event that
happens in the reactor to send out a heartbeat type message at regular
intervals .. This works great !
However, it appears to me that the self.sendLine(msg) and or the
self.transport.write(msg) writing functions are blocked functions
waiting for a reactor event to occur at a future scheduled time before
acutally flushing out the internal write buffers ..
I am currently using the twistd protocol factory to create a custom
protocol to communicate between a server and client, which up until now
has not been a real concern, but I am trying to improve the preformance
and turn around time between the client and server and this blocking
operation is a major source of unneeded delay ..
My problem is that I have scheduled heartbeat events that I want to send
to the server .. as well as the non scheduled events that I want to go
to the server imediately ..
I have been scouring the various python/twistd document sites, but to
no avial, on all of the sites that I have seen, the method used have
all done the same thing , by re-scheduling something into the future
with a reactor.callLater () function, which causes a delayed write to
occur .. not a problem for something that is 1 or 2 second s in the
furture, but it is a serious problem when the next event is 120 seconds
I have tried using a self.transport.write(msg) function, but the actual
communication still seems to be buffered and stuck waiting for the
scheduled reactor event ..
What I think I need is something similar to self.transport.flush()
which would flush out the write buffers on demand, but does not seen to
I am hoping that someone has faced the same/similar stituation and give
me some guidance and/or to point me in the correct direction ..
Thanks for any help you can offer ..
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-web