Package org.zeromq.ZMQ

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


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

    //  Socket to talk to clients
    Socket publisher = context.socket(ZMQ.PUB);
    publisher.bind("tcp://*:5561");

    //  Socket to receive signals
    Socket syncservice = context.socket(ZMQ.REP);
    syncservice.bind("tcp://*:5562");

 
View Full Code Here


    Socket publisher = context.socket(ZMQ.PUB);
    publisher.bind("tcp://*:5561");

    //  Socket to receive signals
    Socket syncservice = context.socket(ZMQ.REP);
    syncservice.bind("tcp://*:5562");

    //  Get synchronization from subscribers
    int subscribers = 0;
    while (subscribers < SUBSCRIBERS_EXPECTED) {
      //  - wait for synchronization request
View Full Code Here

    Socket frontend =  context.socket(ZMQ.SUB);
    frontend.connect("tcp://192.168.55.210:5556");

    //  This is our public endpoint for subscribers
    Socket backend  = context.socket(ZMQ.PUB);
    backend.bind("tcp://10.1.1.0:8100");

    //  Subscribe on everything
    frontend.subscribe("".getBytes());

    boolean more = false;
View Full Code Here

    try {
      if (inboundSockets.containsKey(agentId)) {
        final ZmqConnection conn = inboundSockets.get(agentId);
        final Socket socket = conn.getSocket();
        socket.disconnect(conn.getZmqUrl().toString());
        socket.bind(conn.getZmqUrl().toString());
        conn.listen();
      } else {
        final ZmqConnection socket = new ZmqConnection(
            ZMQ.getSocket(org.zeromq.ZMQ.PULL), this);
        inboundSockets.put(agentId, socket);
View Full Code Here

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

    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);
View Full Code Here

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

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

    String[] topics = { "tech", "music", "design" };
    while (!Thread.currentThread().isInterrupted()) {
      for (int i = 0; i < topics.length; i++) {
        if (socket.send(topics[i], 0))
View Full Code Here

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

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

    Socket receive = context.socket(ZMQ.PULL);
    receive.bind("tcp://localhost:5001");

    while (!Thread.currentThread().isInterrupted()) {
View Full Code Here

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

    Socket receive = context.socket(ZMQ.PULL);
    receive.bind("tcp://localhost:5001");

    while (!Thread.currentThread().isInterrupted()) {
      String message = receive.recvStr(0);
      System.out.println("Received: " + message);
      pub.send(message, 0);
View Full Code Here

        ZContext ctx = new ZContext ();
        assert (ctx != null);

        Socket output = ctx.createSocket (ZMQ.DEALER);
        assert (output != null);
        output.bind ("inproc://selftest");
        Socket input = ctx.createSocket (ZMQ.ROUTER);
        assert (input != null);
        input.connect ("inproc://selftest");
       
        //  Encode/send/decode and verify each message type
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.