I have the following UDP server using Twisted:
threadable.init(1)
reactor.suggestThreadPoolSize(32)
class BaseThreadedUDPServer(DatagramProtocol):
def datagramReceived(self, datagram, (host, port)):
def main():
reactor.listenUDP(PORT, BaseThreadedUDPServer())
reactor.run()
if __name__ == '__main__':
main()
I would like to be able to dismantle this, so from what I read, I have to do something with a .tac file that I can start with "twistd -y my_udp_server_file.tac" - the problem is that I cannot find any documentation on how to do this with this setup. All I can find are examples of how to dismantle simple TCP echo servers (with a .tac file, that is). I need a multithreaded UDP server, such as the one I have.
Any direction is welcome.
source
share