I have the following tcpserver simple example. I'm looking to share the factor counter var with a udp server so on each connect it will inc the value for both tcp and udp. So if i connect first with tcp it will be 2 then if I connect to the port on udp.. it will be 3
#!/usr/bin/env python
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
class TCP(Protocol):
    def connectionMade(self):
        self.factory.counter += 1
        self.transport.write(str(self.factory.counter)+'\r\n')
        self.transport.loseConnection()
class QOTDFactory(Factory):
    def __init__(self, protocol='tcp'):
        if protocol == 'tcp':
            self.protocol = TCP
        else:
            self.protocol = UDP
        self.counter = 1
reactor.listenTCP(8007, QOTDFactory('tcp'))
#reactor.listenUDP(8007, QOTDFactory('udp'))
reactor.run()
My main issue is starting up a UDP class that will work along side.. that is my sticking point. I think how i reference the counter is ok and will work
 
     
     
     
    