/** * Bind to network interface to a random port. Start listenting for new connections. * The main difference from bindToRandomPort is that it allows system to pick up the right port. * For this reason return type is a string and its responsibility of a caller to parse into * the right integer type (e.g. for vmci transport it should be long). * * @param addr the endpoint to bind to. */ public String bindToSystemRandomPort(String addr) { if (ZMQ.version_full() < ZMQ.make_version(3, 2, 0)) throw new UnsupportedOperationException(); bind(String.format("%s:*", addr)); byte[] endpoint_bytes = getBytesSockopt(LAST_ENDPOINT); // NULL-terminated String endpoint_str = new String(Arrays.copyOf(endpoint_bytes, endpoint_bytes.length - 1)); String port = endpoint_str.substring(endpoint_str.lastIndexOf(":") + 1); return port; }
public byte[] getIdentity() { return getBytesSockopt(ZeroMQ$.MODULE$.ZMQ_IDENTITY()); }
public byte[] getIdentity() { return getBytesSockopt(ZeroMQ$.MODULE$.ZMQ_IDENTITY()); }
public byte[] getIdentity() { return getBytesSockopt(ZeroMQ$.MODULE$.ZMQ_IDENTITY()); }
public byte[] getIdentity() { return getBytesSockopt(ZeroMQ$.MODULE$.ZMQ_IDENTITY()); }
/** * Returns the endpoint address represented by the last bind operation. This is useful for * determining the port that was assigned by the operating system in instances where the bind * address contains wildcards, such as tcp://*:*. * * @return the last endpoint. */ public byte[] getLastEndpoint() { if (ZMQ.version_full() >= ZMQ.make_version(3, 2, 0)) { return getBytesSockopt(LAST_ENDPOINT); } else { return null; } }
/** * @see #setIdentity(byte[]) * * @return the Identitiy. */ public byte[] getIdentity() { return getBytesSockopt(IDENTITY); }
/** * @see #setPlainUsername(byte[]) * * @return null terminated byte array in server charset */ public byte[] getPlainUsername() { if (ZMQ.version_full() >= ZMQ.make_version(4, 0, 0)) { return getBytesSockopt(PLAIN_USERNAME); } return null; }
/** * @see #setPlainPassword(byte[]) * * @return null terminated byte array in server charset */ public byte[] getPlainPassword() { if (ZMQ.version_full() >= ZMQ.make_version(4, 0, 0)) { return getBytesSockopt(PLAIN_PASSWORD); } return null; }