[Twisted-Python] Re: closing udp client? (p@)

W.J. miathan at goliath.darktech.org
Wed May 14 08:29:03 EDT 2003


> I want to send a udp packet and then wait for the answer. but what if
> there is no answer? So I need a timeout client...
>
> I tried it with:
>
<snip>
>
> this works. but if I try to close this protocol after 5 seconds with
> self.transport.loseConnection() I get an exception..
> So my actuall question is: how to close this port/protocol/factory
> again?

The timeout is still armed when you lose the connection.

On connection, you do

self.egg = reactor.callLater(5, self.timeout())

When you deconstruct the thing again you do:

self.egg.cancel()

I don't know if this has anything to do with it, but be more
elaborate on which exception you get?

Wladimir





More information about the Twisted-Python mailing list