[Twisted-Python] timeout and retries
sc at linux.it
Sat Jun 18 16:11:46 EDT 2005
Il giorno sab, 18/06/2005 alle 20.34 +1000, Andrew Bennetts ha scritto:
> On Fri, Jun 17, 2005 at 04:41:17PM +0200, Stefano Canepa wrote:
> > The following code is a try to write a protocol with timeout and
> > retries. The connectioMade is used only as a test. I have some problems:
> > 1) even if I placed "\x01" as delimiter the line is sent not terminated
> > def sendLine(self, msg):
> > """
> > Add <SB> (\x01 i.e. SOH) at the start of message as required by
> > HL7 standard and send the message
> > """
> > msgToSend = "\x01"+msg
> > print msgToSend
> > self.transport.write(msgToSend)
> > print "written"
> You've overridden LineReceiver's sendLine to ignore the delimiter attribute.
Thanks I was able to find this error by my own. Thanks.
> > 2) even if timeout expired 3 times the success callback is called
> > d = defer.Deferred()
> > d.addErrback(self.tooManyRetries)
> > d.addCallback(self.success)
> Read the description of how callback/errback chains work again:
> You probably meant:
> d = defer.Deferred()
> d.addCallbacks(self.success, self.tooManyRetries)
> Which has a subtly different meaning.
Now I see the difference, I am really new to twisted and even if I read
the howto and all docs I found on twisted site I need to read all again
to understand better.
Stefano Canepa aka sc: sc at linux.it http://www.stefanocanepa.it
Three great virtues of a programmer: laziness, impatience and hubris.
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20050618/5974f1e3/attachment.pgp
More information about the Twisted-Python