diff options
author | Brennan Ashton <bashton@brennanashton.com> | 2018-11-02 23:50:49 -0700 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2018-11-28 00:02:35 +0100 |
commit | b76a95c52f812181605248f1f590a199e2e5d0e3 (patch) | |
tree | 9493ca923d95928a4a662e2c05f6d1c95b426029 /gr-zeromq/lib/base_impl.cc | |
parent | 0733bc4f788c424264d26c1a1f82d831c91b2c15 (diff) |
gr-zeromq: Add last_endpoint function to zmq source and sink blocks
The main reason for this is is allows you to read back the real
address string in the case that port 0 is used and the OS has
auto-assigned a free port.
Diffstat (limited to 'gr-zeromq/lib/base_impl.cc')
-rw-r--r-- | gr-zeromq/lib/base_impl.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gr-zeromq/lib/base_impl.cc b/gr-zeromq/lib/base_impl.cc index 20c5d3845d..cd1825141b 100644 --- a/gr-zeromq/lib/base_impl.cc +++ b/gr-zeromq/lib/base_impl.cc @@ -54,6 +54,15 @@ namespace gr { delete d_context; } + std::string + base_impl::last_endpoint() + { + size_t addr_len = 256; + char addr[addr_len]; + d_socket->getsockopt(ZMQ_LAST_ENDPOINT, addr, &addr_len); + return std::string(addr, addr_len-1); + } + base_sink_impl::base_sink_impl(int type, size_t itemsize, size_t vlen, char *address, int timeout, bool pass_tags, int hwm) : base_impl(type, itemsize, vlen, timeout, pass_tags) |