[Twisted-Python] does setTcpNoDelay() not work?
Gabriel Rossetti
gabriel.rossetti at arimaz.com
Mon Aug 11 13:13:56 EDT 2008
Gabriel Rossetti wrote:
> Hello,
>
> I'm needing to send small packets to update a progress bar. My update
> msgs were all being sent in big packets, so I tried setting
> setTcpNoDelay() in connectionMade() but it doesn't change anything, is
> it broken?
>
> Thank you,
> Gabriel
>
I an using code that I wrote using threads.deferToThread(), I wondered
if it was blocking the reactor maybe, so I tried just using a plain
deferToThread() call. Here's the code (without all the protocol stuff,
it's executed when data come in.
def loop(self):
import time
m = utils.createMessage("toto", "hello")
while(True):
print "Sending %s" % m.toXml()
self.sendMessage(m)
print "Sent!"
time.sleep(2)
threads.deferToThread(self.loop)
the TCP no delay option is turned on like I said before, the weird thing
is that I have the same thing, all my msgs get sent in big blocks.
Either the TCP no delay doesn't work, or the reactor is getting tied up.
I don' t get it since I'm running the blocking code in a thread, the
reactor should have nothing to do.
Thank you,
Gabriel
P.S.
I know that I'm not returning a deferred, I am in my real code though,
but this is just "debug" code.
More information about the Twisted-Python
mailing list