def testConnectTimeout(self): starttime = time.time() try: leaky = [] for i in range(100): socket = TSocket.TSocket('localhost', self.port) socket.setTimeout(10) socket.open() leaky.append(socket) except: self.assert_(time.time() - starttime < 5.0)
def testConnectTimeout(self): starttime = time.time() try: leaky = [] for i in range(100): socket = TSocket.TSocket('localhost', self.port) socket.setTimeout(10) socket.open() leaky.append(socket) except Exception: self.assert_(time.time() - starttime < 5.0)
def testWriteTimeout(self): starttime = time.time() try: socket = TSocket.TSocket('localhost', self.port) socket.setTimeout(10) socket.open() lsock = self.listen_sock.accept() while True: socket.write("hi" * 100) except: self.assert_(time.time() - starttime < 5.0)
def testWriteTimeout(self): starttime = time.time() try: socket = TSocket.TSocket('localhost', self.port) socket.setTimeout(10) socket.open() lsock = self.listen_sock.accept() while True: lsock.write("hi" * 100) except Exception: self.assert_(time.time() - starttime < 5.0)
#! /bin/python3 import mido, subprocess, socket, os # add a poly synth to the mod-host with s = socket.open(5000): s.send('bundle_add <synth_bundle_dir>') s.send('add <synth_uri> 1') # connect to playback subprocess(['jack_connect', 'effect_1:out1','system:playback1']) # send messages from the keylab to the mod-host