Ejemplo n.º 1
0
 def server(N):
     server = ZmqServer(host=host,
                        port=port,
                        serializer='pickle',
                        deserializer='pickle')
     all_requests = []
     for i in range(N):
         n = server.recv()
         all_requests.append(n)
         server.send(n + 1)
     data[0] = all_requests
Ejemplo n.º 2
0
 def server():
     server = ZmqServer(host=host,
                        port=port,
                        serializer='pickle',
                        deserializer='pickle')
     while True:
         req = server.recv()
         if req == 'request-1':
             server.send('received-request-1')
         elif req == 'request-2':
             time.sleep(0.5)
             server.send('received-request-2')
         elif req == 'request-3':
             server.send('received-request-3')
             break