def main(self): while True: try: self.server.hub.deliver(RandomMessage.generate()) except socket.error: pass time.sleep(random.uniform(0, 7))