Examples of recvStr()


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

    public static void main (String[] args) throws Exception
    {
        ZContext ctx = new ZContext();
        Socket pubpipe = ZThread.fork(ctx, new Publisher());
        Socket subpipe = ZThread.fork(ctx, new Subscriber());
        subpipe.recvStr();
        pubpipe.send("break");
        Thread.sleep(100);
        ctx.destroy();
    }
}
View Full Code Here

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

            subscriber.subscribe("".getBytes());
            subscriber.connect("tcp://localhost:5556");

            //  Get and process messages
            while (true) {
                String string = subscriber.recvStr();
                System.out.printf("%s\n", string);
                long clock = Long.parseLong(string);

                //  Suicide snail logic
                if (System.currentTimeMillis() - clock > MAX_ALLOWED_DELAY) {
View Full Code Here

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

            Socket socket = item.getSocket();

            byte[] identity = socket.recv();
            if (identity != null) {
                //  Request is in second frame of message
                String request = socket.recvStr();
                String subtree = null;
                if (request.equals("ICANHAZ?")) {
                    subtree = socket.recvStr();
                }
                else
View Full Code Here

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

            if (identity != null) {
                //  Request is in second frame of message
                String request = socket.recvStr();
                String subtree = null;
                if (request.equals("ICANHAZ?")) {
                    subtree = socket.recvStr();
                }
                else
                    System.out.printf("E: bad request, aborting\n");

                if (subtree != null) {
View Full Code Here

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

            client.connect("ipc://frontend.ipc");

            //  Send request, get reply
            client.send("HELLO");
            String reply = client.recvStr ();
            System.out.println("Client: " + reply);

            context.destroy ();
        }
    }
View Full Code Here

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

        subscriber.connect("tcp://localhost:5563");
        subscriber.subscribe("B".getBytes());
        while (!Thread.currentThread ().isInterrupted ()) {
            // Read envelope with address
            String address = subscriber.recvStr ();
            // Read message contents
            String contents = subscriber.recvStr ();
            System.out.println(address + " : " + contents);
        }
        subscriber.close ();
View Full Code Here

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

        subscriber.subscribe("B".getBytes());
        while (!Thread.currentThread ().isInterrupted ()) {
            // Read envelope with address
            String address = subscriber.recvStr ();
            // Read message contents
            String contents = subscriber.recvStr ();
            System.out.println(address + " : " + contents);
        }
        subscriber.close ();
        context.term ();
    }
View Full Code Here

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

    Socket socket = context.socket(ZMQ.REP);
    socket.bind("tcp://localhost:5000");

    while (!Thread.currentThread().isInterrupted()) {
      String request = socket.recvStr(0);
      System.out.println("Received request: [" + request + "].");
      socket.send("World", 0);
    }

    socket.close();
View Full Code Here

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

    Socket socket = context.socket(ZMQ.REQ);
    socket.connect("tcp://localhost:5000");

    for (int i = 0; i < 10; i++) {
      socket.send("Hello", 0);
      String reply = socket.recvStr(0);
      System.out.println("Received reply " + i + " [" + reply + "]");
    }

    socket.close();
    context.term();
View Full Code Here

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

    socket.subscribe("tech".getBytes());
    socket.subscribe("music".getBytes());

    while (!Thread.currentThread().isInterrupted()) {
      String reply = socket.recvStr(0);
      System.out.println("Received " + reply);
    }

    socket.close();
    context.term();
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.