Dear Min, File pom.xml inside jzmq-master.zip says "2.1.2-SNAPSHOT"
ZMQ is the latest, i.e. 3.2.2 Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (R&D) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 +56 2 335 2461 gvasq...@altiuz.cl http://www.altiuz.cl http://www.altiuzreports.com El 07-03-2013, a las 22:59, Min <mini...@gmail.com> escribió: > Hi, > > And what version of jzmq and libzmq did you > use? > > Thanks > Min > > 2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성: > This is the client side code that I use to communicate with the server: > > private byte[] getByte(final String table, final String name, > final int doc_off, final int doc_len, final int > comp_off, > final int comp_len, final char compressionType) throws > Exception { > File file = new File(cacheRoot, table.substring(0, 3) + "/DOC/" > + name); //$NON-NLS-1$ > Context ctx = ZMQ.context(1); > > Socket req = ctx.socket(ZMQ.REQ); > req.connect(ENDPOINT); > > // TODO Crear POJO en vez de Map > Map<String, String> params = new HashMap<String, String>(); > params.put("path", file.getAbsolutePath()); > params.put("dOff", String.valueOf(doc_off)); > params.put("dLen", String.valueOf(doc_len)); > params.put("cOff", String.valueOf(comp_off)); > params.put("clen", String.valueOf(comp_len)); > params.put("cType", String.valueOf(compressionType)); > > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > ObjectOutputStream oos = new ObjectOutputStream(baos); > oos.writeObject(params); > oos.close(); > params.clear(); > baos.close(); > > req.send(baos.toByteArray(), NO_FLAGS); > byte[] data = req.recv(); > req.close(); > ctx.term(); > return data; > } > > > And on the server side I use the three attached classes > > public void run() { > // Prepare our context and sockets > Context context = ZMQ.context(1); > Socket frontend = context.socket(ZMQ.ROUTER); > Socket backend = context.socket(ZMQ.DEALER); > frontend.bind("tcp://*:5559"); > backend.bind("inproc://workers"); > > Thread threads[] = new Thread[workers]; > for (int i = 0; i < threads.length; i++) { > threads[i] = new WorkerThread(i, context); > threads[i].start(); > } > System.out.println("launch and connect broker."); > > // Initialize poll set > Poller items = context.poller(2); > items.register(frontend, Poller.POLLIN); > items.register(backend, Poller.POLLIN); > > boolean more = false; > byte[] message; > > // Switch messages between sockets > try { > while (!Thread.currentThread().isInterrupted()) { > // poll and memorize multipart detection > items.poll(); > > if (items.pollin(0)) { > while (true) { > // receive message > message = frontend.recv(0); > more = > frontend.hasReceiveMore(); > > // Broker it > backend.send(message, more ? > ZMQ.SNDMORE : 0); > if (!more) { > break; > } > } > } > if (items.pollin(1)) { > while (true) { > // receive message > message = backend.recv(0); > more = backend.hasReceiveMore(); > // Broker it > frontend.send(message, more ? > ZMQ.SNDMORE : 0); > if (!more) { > break; > } > } > } > } > } finally { > // We never get here but clean up anyhow > frontend.close(); > backend.close(); > context.term(); > } > } > > Does that help solving the problem? > Gonzalo Vásquez Sáez > Gerente Investigación y Desarrollo (R&D) > Altiuz Soluciones Tecnológicas de Negocios Ltda. > Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 > +56 2 335 2461 > gvasq...@altiuz.cl > http://www.altiuz.cl > http://www.altiuzreports.com > > > > El 05-03-2013, a las 18:19, Pieter Hintjens <p...@imatix.com> escribió: > >> >> On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez <gvasq...@altiuz.cl> wrote: >> Hi there! >> >> Upon stressing a Java / ZMQ based piece of software, I'm getting TWO >> repeated errors every now and then, they are: >> >> Hi Gonzalo, >> >> As with any error you're trying to report (to any project, I guess), the >> best tool is a minimal (I can't emphasize that enough) test case that >> provokes the crash. If you can make this in Java we can recreate it in C, >> and see where the problem is. >> >> The test case is essential to fixing the problem since after we fix it we >> have to run the same test case to be 100% the problem is gone. >> >> -Pieter >> >> _______________________________________________ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev