Open qtcdxxyuc opened 5 years ago
I found the reason.
//main.cpp
azmq::socket::identity id;
//typename opt::binary<ZMQ_IDENTITY>
// it create with default constructor,so
// id.size = 0.
//socket_ops.hpp
//when it do this func:
template<typename Option>
static boost::system::error_code
get_option(socket_type & socket, Option & opt, boost::system::error_code & ec) {
BOOST_ASSERT_MSG(socket, "invalid socket");
size_t size = opt.size();
auto rc = zmq_getsockopt(socket.get(), opt.name(), opt.data(), &size);
//if size = 0 ,rc = -1;
if (rc < 0)
ec = make_error_code();
return ec;
}
boost::asio::io_context ioc;
azmq::socket client(ioc,ZMQ_STREAM);
client.connect(ADDRESS);
string id_str('0',5);
azmq::socket::identity id(id_str);
client.get_option(id);
Is it possible to add a constructor for this option?
binary(size_t sz) {
data_.resize(sz);
pv_ = data_.data();
size_ = sz;
}
ZMQ
can get
ZMQ_IDENTITY
. e.g.k�Eg
.AZMQ
other
now
ZMQ_IDENTITY
renamedZMQ_ROUTING_ID
.version
zmq:
4.3.2
boost:
1.7.1
azmq:
github-lasted: 19.11.1