[Twisted-Python] UDP Factories

Jp Calderone exarkun at intarweb.us
Fri Sep 19 18:00:11 EDT 2003

On Fri, Sep 19, 2003 at 05:42:08AM -0600, Justin Johnson wrote:
> I have a UDP protocol that subclasses DatagramProtocol.  It is working
> fine, but I decided I wanted a protocol factory so I can keep track of
> the list of clients.  I added the following class, which doesn't nothing
> currently...
> class MyProtoFactory(Factory):
>     protocol = MyProto

  Factories aren't to be used with DatagramProtocols, since a single
DatagramProtocol instance manages all traffic to and from the ports you

  If you want to share state between different DatagramProtocol instances,
give them a reference to a common object manually (not a factory, but
perhaps a service), or reconsider and use a single instance to talk to all
your clients.  Nothing prevents you from listening on multiple ports with
the same instance.


"Pascal is Pascal is Pascal is dog meat."
                -- M. Devine and P. Larson, Computer Science 340
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030919/e5985302/attachment.pgp 

More information about the Twisted-Python mailing list