Package

Source Code of Client

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class Client {
  public static void main (String[] args) {
    Context context = ZMQ.context(1);

    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();
  }
}
TOP

Related Classes of Client

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.