Package org.zeromq.ZMQ

Examples of org.zeromq.ZMQ.Socket.recv()


        //  Second frame is empty
        String empty = new String(backend.recv(0));
        assert empty.length()==0 | true;

        //  Third frame is READY or else a client reply address
        String client_addr = new String(backend.recv(0));

        //  If client reply, send rest back to frontend
        if (!client_addr.equals("READY")) {

          empty = new String(backend.recv(0));
View Full Code Here


        String client_addr = new String(backend.recv(0));

        //  If client reply, send rest back to frontend
        if (!client_addr.equals("READY")) {

          empty = new String(backend.recv(0));
          assert empty.length()==0 | true;

          String reply = new String(backend.recv(0));
          frontend.send(client_addr.getBytes(), ZMQ.SNDMORE);
          frontend.send("".getBytes(), ZMQ.SNDMORE);
View Full Code Here

        if (!client_addr.equals("READY")) {

          empty = new String(backend.recv(0));
          assert empty.length()==0 | true;

          String reply = new String(backend.recv(0));
          frontend.send(client_addr.getBytes(), ZMQ.SNDMORE);
          frontend.send("".getBytes(), ZMQ.SNDMORE);
          frontend.send(reply.getBytes(), 0);

          if (--client_nbr == 0)
View Full Code Here

   
    System.out.println("launch and connect client.");

    for (int request_nbr = 0; request_nbr < 10; request_nbr++) {
      requester.send("Hello".getBytes(), 0);
      byte[] reply = requester.recv(0);
      String replyValue = new String(reply);
      System.out.println("Received reply "+request_nbr+" ["+replyValue+"]");
    }
   
    //  We never get here but clean up anyhow
View Full Code Here

   
    System.out.println("launch and connect server.");

    while (!Thread.currentThread().isInterrupted()) {
      //  Wait for next request from client
      byte[] request = responder.recv(0);
      String string = new String(request);
      System.out.println("Received request: ["+string+"].");

      //  Do some 'work'
      try {
View Full Code Here

    //  Get synchronization from subscribers
    int subscribers = 0;
    while (subscribers < SUBSCRIBERS_EXPECTED) {
      //  - wait for synchronization request
      byte[] value = syncservice.recv(0);

      //  - send synchronization reply
      syncservice.send("".getBytes(), 0);
      subscribers++;
    }
View Full Code Here

    //  - send a synchronization request
    syncclient.send("".getBytes(), 0);

    //  - wait for synchronization reply
    byte[] value = syncclient.recv(0);

    //  Third, get our updates and report how many we got
    int update_nbr = 0;
    while (true) {
      byte[] stringValue = subscriber.recv(0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.