When we bind socket with wild-card * address (e.g. "tcp://127.0.0.1:*" or
"ipc://*"),
and try to unbind with real endpoint then it fails with error "No such file
or directory".
Example code:
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
int main (void) {
int rc;
size_t buf_size=100;
char buffer[buf_size];
void *context = zmq_ctx_new ();
void *socket = zmq_socket (context, ZMQ_SUB);
rc = zmq_bind (socket, "tcp://127.0.0.1:*");
assert (rc == 0);
rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buffer, &buf_size);
assert (rc == 0);
printf("%s\n", buffer);
rc = zmq_unbind (socket, buffer);
if (rc == -1)
printf ("ERROR: %s\n", strerror (errno));
}
The output of executing above is:
tcp://127.0.0.1:39969
ERROR: No such file or directory
When we try to unbind with endpoint "tcp://127.0.0.1:*" it unbinds clearly.
This behaviour is ok, when we have one binding per socket.
BUT when we bind socket to several endpoints with wild-card we have no
control over
exact unbinding our endpoints. I think we REALLY SHOULD be able to unbind
socket by real endpoint
returned via getsockopt(ZMQ_LAST_ENDPOINT).
The same behaviour with ipc transport ("ipc://*").
Tested on zmq 4.0.4 on Debian Jessie.
--
Loren
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev