artemv

artemv#zmq#close

Sep 20th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1.   @Test
  2.   public void t0() {
  3.     ZMQ.Context context = ZMQ.context(1);
  4.     ZMQ.Socket rep = null;
  5.     ZMQ.Socket req = null;
  6.     try {
  7.       rep = context.socket(ZMQ.REP);
  8.       rep.bind(INPROC_URL);
  9.  
  10.       TimeUnit.SECONDS.sleep(1);
  11.  
  12.       for (int i = 1; ; i++) {
  13.         req = context.socket(ZMQ.REQ);
  14.         req.connect(INPROC_URL);
  15.  
  16.         // want to do some send/recv and then dispose channel
  17.         // ...
  18.  
  19.         req.close();
  20.         System.out.println("iter# " + i);
  21.       }
  22.     }
  23.     finally {
  24.       rep.close();
  25.       context.term();
  26.     }
  27.   }
Advertisement
Add Comment
Please, Sign In to add comment