
Torbjörn Einarsson wrote:
Thanks a lot!
A related question: how do I in the simplest way send UDP data to 10 different ports.
In standard Python I would do sock = socket.socket(AF_INET, socket.SOCK_DGRAM) for port in portList: sock.sendto(data,(host,port)) sock.close()
What is the corresponding thing in Twisted? (I've only found listenUDP and connected UDP).
As I understand it you want to tie different servers together. The "Server Factory" base class for TCP connections is an abstraction layer which makes it possible to spawn different server protocols , see:
http://twistedmatrix.com/documents/current/howto/tutorial/factory
There is no UDP Factory base class that can be used to wrap different UDP protocol instances.
I achieve this by writing my own application layer which ties everything together- see:
http://twistedmatrix.com/pipermail/twisted-python/2005-March/009888.html
Alternatively - I suspect one could also simply inherit from service.Application and code your "application layer" stuff in there.
regards,
Eugene Coetzee