Hi guys, I messing around with JNI and libzmq and I was wondering if there was a way to avoid the memcpy?
JNIEXPORT jobject JNICALL Java_org_zeromq_jni_ZMQ_zmq_1recv__JI (JNIEnv *env, jclass c, jlong socket, jint flags) { zmq_msg_t msg; zmq_msg_init (&msg); zmq_recvmsg ((void *) socket, &msg, flags); int size = zmq_msg_size (&msg); void *data = malloc(size); memcpy(data, zmq_msg_data (&msg), size); zmq_msg_close(&msg); return env->NewDirectByteBuffer(data, size); } Cheers, Trev _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev