use of zmq.ZObject in project jeromq by zeromq.
the class SessionBase method zapConnect.
public int zapConnect() {
assert (zapPipe == null);
Ctx.Endpoint peer = findEndpoint("inproc://zeromq.zap.01");
if (peer.socket == null) {
errno.set(ZError.ECONNREFUSED);
return ZError.ECONNREFUSED;
}
if (peer.options.type != ZMQ.ZMQ_REP && peer.options.type != ZMQ.ZMQ_ROUTER && peer.options.type != ZMQ.ZMQ_SERVER) {
errno.set(ZError.ECONNREFUSED);
return ZError.ECONNREFUSED;
}
// Create a bi-directional pipe that will connect
// session with zap socket.
ZObject[] parents = { this, peer.socket };
int[] hwms = { 0, 0 };
boolean[] conflates = { false, false };
Pipe[] pipes = Pipe.pair(parents, hwms, conflates);
// Attach local end of the pipe to this socket object.
zapPipe = pipes[0];
zapPipe.setNoDelay();
zapPipe.setEventSink(this);
sendBind(peer.socket, pipes[1], false);
// Send empty identity if required by the peer.
if (peer.options.recvIdentity) {
Msg id = new Msg();
id.setFlags(Msg.IDENTITY);
zapPipe.write(id);
zapPipe.flush();
}
return 0;
}
use of zmq.ZObject in project jeromq by zeromq.
the class MTrieTest method createPipe.
private Pipe createPipe() {
ZObject object = new ZObject(null, 0) {
};
Pipe[] pair = Pipe.pair(new ZObject[] { object, object }, new int[2], new boolean[2]);
return pair[0];
}