ZMQ_Send.java
Go to the documentation of this file.
1 package grl.flatBufferTesting;
2 
3 import java.util.concurrent.TimeUnit;
4 import org.zeromq.ZMQ;
5 
6 public class ZMQ_Send {
7  static final String TOPIC = "topic1";
8  static final int NUM_MSG = 10;
9  public static void main(String[] args) throws Exception {
10  long bTime = System.currentTimeMillis();
11 
12  // Prepare our context and publisher
13  ZMQ.Context context = ZMQ.context(1);
14  ZMQ.Socket publisher = context.socket(ZMQ.DEALER);
15  publisher.bind("tcp://127.0.0.1:5563");
16  publisher.setHWM(1000000);
17  publisher.setSndHWM(1000000);
18 
19  int c = 0;
20  while (c < NUM_MSG) {
21  byte [] msg = {0,1,2,3,4,(byte) c};
22  c++;
23  publisher.send(msg,0);
24  System.out.println(msg);
25  }
26 
27  long secs = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - bTime);
28  System.out.println("Wuclient done at "+c + " in "+secs + " seconds");
29  Thread.sleep(2000);
30  publisher.close();
31  context.term();
32  System.exit(1);
33  }
34 }
static void main(String[] args)
Definition: ZMQ_Send.java:9