def resolver(name, address): context = zmq.Context() image_send = context.socket(zmq.PULL) print "Connecting to", address image_send.connect(address) print "Connected" while True: img = image_send.recv_pyobj() print "Resolving a new image" flood_fill_horiz(img, '/tmp/output.png', 0, 0)
def resolver(name, address): context = zmq.Context() task_socket = context.socket(zmq.REQ) task_socket.connect(address) while 1: task_socket.send('GET') msg = task_socket.recv() print msg if msg.startswith('ADDRESS'): task_address = msg.split()[1] break image_send = context.socket(zmq.PULL) print "Connecting to", address image_send.connect(task_address) print "Connected" while True: img = image_send.recv_pyobj() print "Resolving a new image" flood_fill_horiz(img, '/tmp/output.png', 0, 0)