<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left>&nbsp;</DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT face=Arial size=2><SPAN 
class=512361800-24022010>Hi Folks ..</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010><SPAN 
class=184094700-24022010>I'm not entirely a newbie a python and twisted, but I 
have come to the point where I need a bit more expertise&nbsp;on this topic, so 
I am hoping that I have come to the right place 
..&nbsp;</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010><SPAN 
class=184094700-24022010></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2><SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>What&nbsp;</FONT>&nbsp;</FONT></SPAN>I'm hoping<SPAN 
class=184094700-24022010>,&nbsp;</SPAN>that&nbsp;<SPAN 
class=184094700-24022010><FONT color=#0000ff>&nbsp;<FONT color=#000000>you 
folks</FONT>&nbsp;</FONT></SPAN>can help out with a<SPAN 
class=184094700-24022010><FONT color=#0000ff>&nbsp;</FONT><FONT 
color=#000000>minor&nbsp;</FONT></SPAN>prob<SPAN 
class=184094700-24022010>l</SPAN>em that I am having with&nbsp;<SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>the</FONT>&nbsp;</FONT></SPAN>twistd reactor 
class&nbsp;and/or&nbsp;<SPAN class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>the</FONT> </FONT></SPAN>callLater&nbsp;<SPAN 
class=184094700-24022010>function</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=512361800-24022010><SPAN class=184094700-24022010><FONT 
face=Arial size=2>&nbsp;</FONT> 
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010>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 
!</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2>However, it 
appears to me that the self.sendLine(msg)&nbsp;<SPAN 
class=184094700-24022010><FONT color=#0000ff>&nbsp;<FONT color=#000000>and 
or</FONT> </FONT>the self.transport.write(msg) </SPAN>writ<SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>ing</FONT>&nbsp;</FONT></SPAN> functio<FONT color=#0000ff><SPAN 
class=184094700-24022010><FONT color=#000000>ns</FONT>&nbsp;</SPAN><SPAN 
class=184094700-24022010><FONT color=#000000>are</FONT></SPAN></FONT> blocked 
function<SPAN class=184094700-24022010>s&nbsp;</SPAN>waiting&nbsp;for&nbsp;<SPAN 
class=184094700-24022010>a</SPAN><SPAN 
class=184094700-24022010>&nbsp;</SPAN>reactor event<SPAN 
class=184094700-24022010> to occur&nbsp;at a future scheduled </SPAN>time before 
acutally flushing out the internal write buffers ..&nbsp;<SPAN 
class=184094700-24022010><FONT 
color=#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2><SPAN 
class=184094700-24022010></SPAN></FONT></FONT></SPAN>&nbsp;</DIV></SPAN></SPAN></DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2>I am currently 
using the twistd protocol factory to create a custom protocol to communicate 
between a server and client<SPAN class=184094700-24022010><FONT color=#0000ff>, 
&nbsp;</FONT></SPAN><SPAN class=184094700-24022010>which up until now has not 
been a real concern, but I am trying to improve the preformance and turn around 
time&nbsp;between the client and server and this blocking operation is a major 
source of&nbsp;&nbsp;unneeded delay .. </SPAN></FONT></FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010>My problem is that I 
have&nbsp;scheduled heartbeat events that I want to send to the server .. as 
well as&nbsp;<SPAN class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>&nbsp;the</FONT> &nbsp;</FONT></SPAN>non scheduled events that I 
want to g<SPAN class=184094700-24022010>o&nbsp;</SPAN> to the server imediately 
.. </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010>I have been scouring 
the various python/twistd &nbsp;document sites,&nbsp;<SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT color=#000000>but to 
no&nbsp;avial</FONT>,&nbsp;</FONT></SPAN> on all of the site<SPAN 
class=184094700-24022010>s&nbsp;</SPAN>that I have seen, the method used ha<SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>ve</FONT>&nbsp;</FONT></SPAN> all done the same thing<SPAN 
class=184094700-24022010><FONT color=#0000ff>&nbsp;,&nbsp;</FONT></SPAN> 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 secon<SPAN class=184094700-24022010><FONT color=#0000ff><FONT 
color=#000000>d</FONT>&nbsp;</FONT></SPAN>s in the furture, but it is a serious 
problem when the next event is 120 seconds away .. </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2>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 ..<SPAN 
class=184094700-24022010><FONT 
color=#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2><SPAN 
class=184094700-24022010></SPAN></FONT></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial><FONT size=2><SPAN 
class=184094700-24022010><FONT color=#0000ff><FONT color=#000000>What I think I 
need is something similar to</FONT>&nbsp;</FONT>&nbsp;self.transport.flush() 
which would flush out the write buffers on demand, but does not seen to exist 
..</SPAN></FONT></FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010>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 ..&nbsp;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=512361800-24022010></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=512361800-24022010>Thanks for any help 
you can offer ..</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial 
size=2>Cheers</FONT></SPAN></DIV>
<DIV><SPAN class=512361800-24022010><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV align=left><FONT face=Arial size=2>Dave Watson</FONT></DIV></BODY></HTML>