Package org.zeromq.ZMQ

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


  @Test
  public void testMultiPart() {
    ZContext ctx = new ZContext();

    Socket output = ctx.createSocket(ZMQ.PAIR);
    output.bind("inproc://zmsg.test2");
    Socket input = ctx.createSocket(ZMQ.PAIR);
    input.connect("inproc://zmsg.test2");
   
    ZMsg msg = new ZMsg();
    for (int i = 0;i < 10;i++)
View Full Code Here


 
  @Test
  public void testSending() {
    ZContext ctx = new ZContext();
    Socket output = ctx.createSocket(ZMQ.PAIR);
    output.bind("inproc://zframe.test");
    Socket input = ctx.createSocket(ZMQ.PAIR);
    input.connect("inproc://zframe.test");
   
    // Send five different frames, test ZFRAME_MORE
    for (int i=0;i<5;i++) {
View Full Code Here

 
  @Test
  public void testCopyingAndDuplicating() {
    ZContext ctx = new ZContext();
    Socket output = ctx.createSocket(ZMQ.PAIR);
    output.bind("inproc://zframe.test");
    Socket input = ctx.createSocket(ZMQ.PAIR);
    input.connect("inproc://zframe.test");

    ZFrame f = new ZFrame("Hello".getBytes());
    ZFrame copy = f.duplicate();
View Full Code Here

 
  @Test
  public void testReceiving() {
    ZContext ctx = new ZContext();
    Socket output = ctx.createSocket(ZMQ.PAIR);
    output.bind("inproc://zframe.test");
    Socket input = ctx.createSocket(ZMQ.PAIR);
    input.connect("inproc://zframe.test");

    // Send same frame five times
    ZFrame f = new ZFrame("Hello".getBytes());
View Full Code Here

 
  @Test
  public void testStringFrames() {
    ZContext ctx = new ZContext();
    Socket output = ctx.createSocket(ZMQ.PAIR);
    output.bind("inproc://zframe.test");
    Socket input = ctx.createSocket(ZMQ.PAIR);
    input.connect("inproc://zframe.test");

    ZFrame f1 = new ZFrame("Hello");
    assertEquals(5, f1.getData().length);
View Full Code Here

    Context context = ZMQ.context(1);

    Socket frontend = context.socket(ZMQ.ROUTER);
    Socket backend  = context.socket(ZMQ.DEALER);
    frontend.bind("tcp://*:5559");
    backend.bind("tcp://*:5560");

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

    //  Initialize poll set
    Poller items = context.poller(2);
View Full Code Here

    //  Prepare our context and sockets
    Socket frontend  = context.socket(ZMQ.ROUTER);
    Socket backend  = context.socket(ZMQ.ROUTER);
    frontend.bind("ipc://frontend.ipc");
    backend.bind("ipc://backend.ipc");

    int client_nbr;
    for (client_nbr = 0; client_nbr < 10; client_nbr++)
      new ClientThread().start();
View Full Code Here

        public void run() {
            ZContext ctx = new ZContext();
            Socket frontend = ctx.createSocket(ZMQ.ROUTER);
            Socket backend = ctx.createSocket(ZMQ.ROUTER);
            frontend.bind("tcp://*:5555");
            backend.bind("tcp://*:5556");

            while (!Thread.currentThread().isInterrupted()) {
                ZMQ.Poller items = ctx.getContext().poller();
                items.register(frontend, ZMQ.Poller.POLLIN);
                items.register(backend, ZMQ.Poller.POLLIN);
View Full Code Here

    //  Prepare our context and sockets
    Context context = ZMQ.context(1);

    //  Socket facing clients
    Socket frontend = context.socket(ZMQ.ROUTER);
    frontend.bind("tcp://*:5559");

    //  Socket facing services
    Socket backend = context.socket(ZMQ.DEALER);
    backend.bind("tcp://*:5560");

 
View Full Code Here

    Socket frontend = context.socket(ZMQ.ROUTER);
    frontend.bind("tcp://*:5559");

    //  Socket facing services
    Socket backend = context.socket(ZMQ.DEALER);
    backend.bind("tcp://*:5560");

    //  Start built-in device
    ZMQQueue queue = new ZMQQueue(context, frontend, backend);
    // have fun!
   
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.