from twisted.internet import task
from twisted.internet import reactor
datagramRecieved = False
timeout = 1.0

def testTimeout():
    global datagramRecieved
if not datagramRecieved:
    reactor.stop()
datagramRecieved = False
l = task.LoopingCall(testTimeout)
l.start(timeout)
reactor.run()
Is it possible to set a timeout on a socket in Twisted?