@@ -0,0 +1,1265 @@
+from __future__ import print_function, absolute_import, unicode_literals, division%0Afrom messages import DispatchInquiry, Dispatched%0A%0Afrom stackable.stackable import StackableError%0Afrom stackable.network import StackableSocket, StackablePacketAssembler%0Afrom stackable.utils import StackablePickler%0Afrom stackable.stack import Stack%0A%0Afrom runnable.runnable import ExecRunnable%0Afrom runnable.network import RunnableServer, RequestObject%0A%0Aclients = %5B%5D%0Aclass Dispatcher(RequestObject):%0A%09def init(self):%0A%09%09self.stack = Stack((StackableSocket(sock=self.conn),%0A%09%09                   StackablePacketAssembler(),%0A%09%09                   StackablePickler()))%0A%09%09clients.append(self)%0A%0A%09%09self.dispatch(DispatchInquiry(msg='dispatch', payload=ExecRunnable('print %22WEEEE%22; import sys; print sys.path')))%0A%0A%09def destroy(self):%0A%09%09clients.remove(self)%0A%09%09self.stack.close()%0A%09%09del self.stack%0A%0A%09def dispatch(self, w):%0A%09%09self.stack.write(w)%0A%0A%09def receive(self):%0A%09%09try:%0A%09%09%09obj = self.stack.poll()%0A%09%09%09if obj != None:%0A%09%09%09%09if isinstance(obj,Dispatched):%0A%09%09%09%09%09print('%5BRETVAL%5D', obj.output)%0A%09%09%09%09else:%0A%09%09%09%09%09print(%22%5BERROR%5D%22, type(obj))%0A%09%09%09return True%0A%09%09except StackableError:%0A%09%09%09return False%0A%0Aif __name__ == '__main__':%0A%09server = RunnableServer(%7B'reqObj': Dispatcher, 'port': 2501%7D)%0A%09server.execute()%0A

Add controlling server