[zeromq-dev] some trouble with zyre
Juergen Gnoss
jgnoss at hotmail.com
Wed Dec 9 05:23:13 CET 2020
I’m not so new to zmq but absolutely new to zyre.
I’ve an application where zyre seems to be the way to go, but I’m struggling to get it go.
I think I have a clue what zyre should do, but still not sure about that
I need somebody to bring me some light in
if I run 2 instances of the program on the same machine, it does as (I) expect.
if I run it on different machines it does strange things I do not understand at all.
here the code
a basic try
#include "zyre.h"
#define ROOM "DEFAULT"
int main(int argc, char *argv[]) {
if (argc < 3) {
puts("syntax: ./pc_zyreObserver name room");
exit(0);
}
const char *name = argv[1];
const char *room = argv[2];
assert(name);
assert(room);
zyre_t *node1 = zyre_new(name);
assert(node1);
zyre_set_header(node1, "X-HELLO", "World");
zyre_set_verbose (node1);
if (zyre_start(node1)) {
zyre_destroy(&node1);
printf("OK (skipping test, no UDP discovery)\n");
return -1;
}
zyre_join(node1, room);
zpoller_t *poller = zpoller_new(zyre_socket(node1), NULL);
assert(poller);
zclock_sleep (250);
uint8_t cnt = 0;
while (!zsys_interrupted) {
void *which = zpoller_wait(poller, 500);
if (which == zyre_socket(node1)) {
} else if (zpoller_expired(poller)) {
/*
zsys_info("[%s] shouting into [%s]", name, room);
zmsg_t *msg = zmsg_new ();
zmsg_addstr (msg, "Hello, World");
zyre_shout (node1, room, &msg);
*/
} else if (zpoller_terminated(poller)) {
zsys_info("poller_terminated\n bye bye ...");
break; // Interrupted
}
}
zyre_destroy (&node1);
}
and the output on different sceneries
started 2 times on the same PC
mav1
D: 20-12-08 22:46:44 mav1: API command=START
I: 20-12-08 22:46:44 zbeacon: API command=CONFIGURE
I: 20-12-08 22:46:44 zbeacon: interface=enp3s0 address=192.168.1.106 broadcast=192.168.1.255
I: 20-12-08 22:46:44 zbeacon: configured, hostname=192.168.1.106
D: 20-12-08 22:46:44 mav1: API command=JOIN
I: 20-12-08 22:46:44 zbeacon: API command=PUBLISH
I: 20-12-08 22:46:44 (mav1) JOIN group=TTT
I: 20-12-08 22:46:44 zbeacon: API command=SUBSCRIBE
I: 20-12-08 22:46:44 (mav1) connect to peer: endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:46:44 (mav1) send HELLO to peer=- sequence=1
I: 20-12-08 22:46:44 (mav1) recv HELLO from peer=- sequence=1
I: 20-12-08 22:46:44 (mav1) ENTER name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:46:44 (mav1) JOIN name=mav2 group=TTT
I: 20-12-08 22:46:49 (mav1) peer does not send messages (evasive) name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:46:49 (mav1) send PING to peer=mav2 sequence=2
I: 20-12-08 22:46:49 (mav1) recv PING_OK from peer=mav2 sequence=2
I: 20-12-08 22:46:54 (mav1) peer does not send messages (evasive) name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:46:54 (mav1) send PING to peer=mav2 sequence=3
I: 20-12-08 22:46:54 (mav1) recv PING_OK from peer=mav2 sequence=3
I: 20-12-08 22:46:59 (mav1) peer does not send messages (evasive) name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:46:59 (mav1) send PING to peer=mav2 sequence=4
I: 20-12-08 22:46:59 (mav1) recv PING_OK from peer=mav2 sequence=4
I: 20-12-08 22:47:04 (mav1) peer does not send messages (evasive) name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:47:04 (mav1) send PING to peer=mav2 sequence=5
I: 20-12-08 22:47:04 (mav1) recv PING_OK from peer=mav2 sequence=5
^CI: 20-12-08 22:47:06 poller_terminated
bye bye …
D: 20-12-08 22:47:06 mav1: API command=[TERM I: 20-12-08 22:47:06 zbeacon: API command=]TERM
mav2
D: 20-12-08 22:46:34 mav2: API command=START
I: 20-12-08 22:46:34 zbeacon: API command=CONFIGURE
I: 20-12-08 22:46:34 zbeacon: interface=enp3s0 address=192.168.1.106 broadcast=192.168.1.255
I: 20-12-08 22:46:34 zbeacon: configured, hostname=192.168.1.106
I: 20-12-08 22:46:34 zbeacon: API command=PUBLISH
D: 20-12-08 22:46:34 mav2: API command=JOIN
I: 20-12-08 22:46:34 (mav2) JOIN group=TTT
I: 20-12-08 22:46:34 zbeacon: API command=SUBSCRIBE
I: 20-12-08 22:46:44 (mav2) connect to peer: endpoint=tcp://192.168.1.106:49153
I: 20-12-08 22:46:44 (mav2) send HELLO to peer=- sequence=1
I: 20-12-08 22:46:44 (mav2) recv HELLO from peer=- sequence=1
I: 20-12-08 22:46:44 (mav2) ENTER name=mav1 endpoint=tcp://192.168.1.106:49153
I: 20-12-08 22:46:44 (mav2) JOIN name=mav1 group=TTT
I: 20-12-08 22:46:49 (mav2) recv PING from peer=mav1 sequence=2
I: 20-12-08 22:46:49 (mav2) send PING_OK to peer=mav1 sequence=2
I: 20-12-08 22:46:54 (mav2) recv PING from peer=mav1 sequence=3
I: 20-12-08 22:46:54 (mav2) send PING_OK to peer=mav1 sequence=3
I: 20-12-08 22:46:59 (mav2) recv PING from peer=mav1 sequence=4
I: 20-12-08 22:46:59 (mav2) send PING_OK to peer=mav1 sequence=4
I: 20-12-08 22:47:04 (mav2) recv PING from peer=mav1 sequence=5
I: 20-12-08 22:47:04 (mav2) send PING_OK to peer=mav1 sequence=5
^CI: 20-12-08 22:47:10 poller_terminated
bye bye …
D: 20-12-08 22:47:10 mav2: API command=[TERM I: 20-12-08 22:47:10 zbeacon: API command=]TERM
/**/
started on beaglebone and PC
the BB
D: 20-12-09 03:41:52 bb1: API command=START
I: 20-12-09 03:41:52 zbeacon: API command=CONFIGURE
I: 20-12-09 03:41:52 zbeacon: interface=eth0 address=192.168.1.110 broadcast=192.168.1.255
I: 20-12-09 03:41:52 zbeacon: configured, hostname=192.168.1.110
D: 20-12-09 03:41:52 bb1: API command=JOIN
I: 20-12-09 03:41:52 (bb1) JOIN group=TTT
I: 20-12-09 03:41:52 zbeacon: API command=PUBLISH
I: 20-12-09 03:41:52 zbeacon: API command=SUBSCRIBE
I: 20-12-09 03:41:55 (bb1) connect to peer: endpoint=tcp://192.168.1.106:49152
I: 20-12-09 03:41:55 (bb1) send HELLO to peer=- sequence=1
I: 20-12-09 03:41:55 (bb1) recv HELLO from peer=- sequence=1
I: 20-12-09 03:41:55 (bb1) ENTER name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-09 03:41:55 (bb1) JOIN name=mav2 group=TTT
I: 20-12-09 03:42:01 (bb1) recv PING from peer=mav2 sequence=2
I: 20-12-09 03:42:01 (bb1) send PING_OK to peer=mav2 sequence=2
I: 20-12-09 03:42:02 (bb1) recv PING from peer=mav2 sequence=3
I: 20-12-09 03:42:02 (bb1) send PING_OK to peer=mav2 sequence=3
I: 20-12-09 03:42:03 (bb1) recv PING from peer=mav2 sequence=4
I: 20-12-09 03:42:03 (bb1) send PING_OK to peer=mav2 sequence=4
I: 20-12-09 03:42:04 (bb1) recv PING from peer=mav2 sequence=5
I: 20-12-09 03:42:04 (bb1) send PING_OK to peer=mav2 sequence=5
I: 20-12-09 03:42:05 (bb1) recv PING from peer=mav2 sequence=6
I: 20-12-09 03:42:05 (bb1) send PING_OK to peer=mav2 sequence=6
I: 20-12-09 03:42:06 (bb1) recv PING from peer=mav2 sequence=7
I: 20-12-09 03:42:06 (bb1) send PING_OK to peer=mav2 sequence=7
^CI: 20-12-09 03:42:11 poller_terminated
bye bye …
D: 20-12-09 03:42:11 bb1: API command=[TERM I: 20-12-09 03:42:11 zbeacon: API command=]TERM
the mav
D: 20-12-08 22:41:55 mav2: API command=START
I: 20-12-08 22:41:55 zbeacon: API command=CONFIGURE
I: 20-12-08 22:41:55 zbeacon: interface=enp3s0 address=192.168.1.106 broadcast=192.168.1.255
I: 20-12-08 22:41:55 zbeacon: configured, hostname=192.168.1.106
I: 20-12-08 22:41:55 zbeacon: API command=PUBLISH
D: 20-12-08 22:41:55 mav2: API command=JOIN
I: 20-12-08 22:41:55 (mav2) JOIN group=TTT
I: 20-12-08 22:41:55 zbeacon: API command=SUBSCRIBE
I: 20-12-08 22:41:55 (mav2) connect to peer: endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:41:55 (mav2) send HELLO to peer=- sequence=1
I: 20-12-08 22:42:01 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:01 (mav2) send PING to peer=- sequence=2
I: 20-12-08 22:42:02 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:02 (mav2) send PING to peer=- sequence=3
I: 20-12-08 22:42:02 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:42:03 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:03 (mav2) send PING to peer=- sequence=4
I: 20-12-08 22:42:03 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:42:04 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:04 (mav2) send PING to peer=- sequence=5
I: 20-12-08 22:42:04 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:42:05 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:05 (mav2) send PING to peer=- sequence=6
I: 20-12-08 22:42:05 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:42:06 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.110:49152
I: 20-12-08 22:42:06 (mav2) send PING to peer=- sequence=7
I: 20-12-08 22:42:06 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
^CI: 20-12-08 22:42:07 poller_terminated
bye bye …
D: 20-12-08 22:42:07 mav2: API command=[TERM I: 20-12-08 22:42:07 zbeacon: API command=]TERM
/**/
a virtual machine and the pc with ethernet bridged (the two are in same LAN)
the virtual machine on PC
D: 20-12-08 22:49:51 v-buster: API command=START
I: 20-12-08 22:49:51 zbeacon: API command=CONFIGURE
I: 20-12-08 22:49:51 zbeacon: interface=enp0s3 address=192.168.1.108 broadcast=192.168.1.255
I: 20-12-08 22:49:51 zbeacon: configured, hostname=192.168.1.108
D: 20-12-08 22:49:51 v-buster: API command=JOIN
I: 20-12-08 22:49:51 (v-buster) JOIN group=TTT
I: 20-12-08 22:49:51 zbeacon: API command=PUBLISH
I: 20-12-08 22:49:51 zbeacon: API command=SUBSCRIBE
I: 20-12-08 22:50:17 (v-buster) connect to peer: endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:50:17 (v-buster) send HELLO to peer=- sequence=1
I: 20-12-08 22:50:18 (v-buster) recv HELLO from peer=- sequence=1
I: 20-12-08 22:50:18 (v-buster) ENTER name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:50:18 (v-buster) JOIN name=mav2 group=TTT
I: 20-12-08 22:50:23 (v-buster) peer does not send messages (evasive) name=mav2 endpoint=tcp://192.168.1.106:49152
I: 20-12-08 22:50:23 (v-buster) send PING to peer=mav2 sequence=2
I: 20-12-08 22:50:23 (v-buster) recv PING from peer=mav2 sequence=2
I: 20-12-08 22:50:23 (v-buster) send PING_OK to peer=mav2 sequence=3
I: 20-12-08 22:50:24 (v-buster) recv PING from peer=mav2 sequence=3
I: 20-12-08 22:50:24 (v-buster) send PING_OK to peer=mav2 sequence=4
I: 20-12-08 22:50:25 (v-buster) recv PING from peer=mav2 sequence=4
I: 20-12-08 22:50:25 (v-buster) send PING_OK to peer=mav2 sequence=5
I: 20-12-08 22:50:26 (v-buster) recv PING from peer=mav2 sequence=5
I: 20-12-08 22:50:26 (v-buster) send PING_OK to peer=mav2 sequence=6
I: 20-12-08 22:50:27 (v-buster) recv PING from peer=mav2 sequence=6
I: 20-12-08 22:50:27 (v-buster) send PING_OK to peer=mav2 sequence=7
I: 20-12-08 22:50:28 (v-buster) recv PING from peer=mav2 sequence=7
I: 20-12-08 22:50:28 (v-buster) send PING_OK to peer=mav2 sequence=8
I: 20-12-08 22:50:29 (v-buster) recv PING from peer=mav2 sequence=8
I: 20-12-08 22:50:29 (v-buster) send PING_OK to peer=mav2 sequence=9
I: 20-12-08 22:50:30 (v-buster) recv PING from peer=mav2 sequence=9
I: 20-12-08 22:50:30 (v-buster) send PING_OK to peer=mav2 sequence=10
I: 20-12-08 22:50:31 (v-buster) recv PING from peer=mav2 sequence=10
I: 20-12-08 22:50:31 (v-buster) send PING_OK to peer=mav2 sequence=11
I: 20-12-08 22:50:32 (v-buster) recv PING from peer=mav2 sequence=11
I: 20-12-08 22:50:32 (v-buster) send PING_OK to peer=mav2 sequence=12
^CI: 20-12-08 22:50:34 poller_terminated
bye bye …
D: 20-12-08 22:50:34 v-buster: API command=[TERM I: 20-12-08 22:50:34 zbeacon: API command=]TERM
the pc
D: 20-12-08 22:50:17 mav2: API command=START
I: 20-12-08 22:50:17 zbeacon: API command=CONFIGURE
I: 20-12-08 22:50:17 zbeacon: interface=enp3s0 address=192.168.1.106 broadcast=192.168.1.255
I: 20-12-08 22:50:17 zbeacon: configured, hostname=192.168.1.106
D: 20-12-08 22:50:17 mav2: API command=JOIN
I: 20-12-08 22:50:17 (mav2) JOIN group=TTT
I: 20-12-08 22:50:17 zbeacon: API command=PUBLISH
I: 20-12-08 22:50:17 zbeacon: API command=SUBSCRIBE
I: 20-12-08 22:50:17 (mav2) connect to peer: endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:17 (mav2) send HELLO to peer=- sequence=1
I: 20-12-08 22:50:23 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:23 (mav2) send PING to peer=- sequence=2
I: 20-12-08 22:50:24 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:24 (mav2) send PING to peer=- sequence=3
I: 20-12-08 22:50:24 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:25 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:25 (mav2) send PING to peer=- sequence=4
I: 20-12-08 22:50:25 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:26 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:26 (mav2) send PING to peer=- sequence=5
I: 20-12-08 22:50:26 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:27 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:27 (mav2) send PING to peer=- sequence=6
I: 20-12-08 22:50:27 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:28 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:28 (mav2) send PING to peer=- sequence=7
I: 20-12-08 22:50:28 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:29 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:29 (mav2) send PING to peer=- sequence=8
I: 20-12-08 22:50:29 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:30 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:30 (mav2) send PING to peer=- sequence=9
I: 20-12-08 22:50:30 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:31 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:31 (mav2) send PING to peer=- sequence=10
I: 20-12-08 22:50:31 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
I: 20-12-08 22:50:32 (mav2) peer does not send messages (evasive) name= endpoint=tcp://192.168.1.108:49152
I: 20-12-08 22:50:32 (mav2) send PING to peer=- sequence=11
I: 20-12-08 22:50:32 (mav2) peer ‘’ has not answered ping after 1000 milliseconds (silent)
^CI: 20-12-08 22:50:32 poller_terminated
bye bye …
D: 20-12-08 22:50:32 mav2: API command=[TERM I: 20-12-08 22:50:32 zbeacon: API command=]TERM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20201209/882c565c/attachment.htm>
More information about the zeromq-dev
mailing list