Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 27 23:27
    sfhacker commented #3964
  • Jan 27 20:13
    yaakob-luoma commented #3964
  • Jan 27 09:53
    bluca closed #4499
  • Jan 27 09:53
    bluca commented #4499
  • Jan 27 09:53
    bluca closed #4498
  • Jan 27 09:53
    bluca commented #4498
  • Jan 27 04:09
    HoangNgo88 opened #4499
  • Jan 27 04:09
    HoangNgo88 opened #4498
  • Jan 27 01:32

    bluca on master

    Add conan badge Add relicense statement Merge pull request #4497 from M… (compare)

  • Jan 27 01:32
    bluca closed #4497
  • Jan 27 01:26
    MartinDelille synchronize #4497
  • Jan 26 23:59
    bluca commented #891
  • Jan 26 23:58
    bluca commented #145
  • Jan 26 23:58
    bluca commented #634
  • Jan 26 23:56
    bluca commented #452
  • Jan 26 23:46
    bluca commented #4497
  • Jan 26 23:34
    MartinDelille edited #4497
  • Jan 26 23:30
    MartinDelille opened #4497
  • Jan 25 20:59
    ratzrattillo opened #4496
  • Jan 25 11:26
    sphaero commented #4484
y2022
@y2022:anonymousland.org
[m]
Also doesn't depends on the sockets.target of systemd?
Hendrik
@Asmod4n
The interface you want to connect to should have an ip address
1 reply
I don’t actually know if ZMQ binds to interfaces which came up while it’s running’s, but i guess it won’t.
y2022
@y2022:anonymousland.org
[m]
The ZMQ nodes are created with the url ipc:///tmp/NIPC/xxx
bv
@bv:matrix.org
[m]
I believe his point is the only indirect dependency on systemd is if 1. your zeromq application used tcp://<ip>:<port> and if 2. systemd on your system was involved in allowing the NIC providing that <ip> to be up and/or opening that <port>.
I can't think of a way that systemd can interfere with ipc:// but perhaps it has become clever enough to do so
Cassiel-girl
@Cassiel-girl
zeromq、rdma or IB, who has performance compare?
bv
@bv:matrix.org
[m]
y2022, thanks for the update. You may of course avoid /tmp all together and pick some other writable ipc:///path/to/xxx.
1 reply
y2022
@y2022:anonymousland.org
[m]
A basic question, does the term "sockets" in ZMQ refer to the network socket or the UNIX domain socket? The doc section here https://zguide.zeromq.org/docs/chapter2/#The-Socket-API mentions it as the the network socket.
bv
@bv:matrix.org
[m]
Neither. In ZeroMQ the "socket" is the PUB, SUB, PUSH, PULL, etc, software "object". A zeromq socket is abstracted from the transports.
1 reply
for example, a single zeromq "socket" may both bind and connect and do so to multiple transports. So, we must think of a zeromq "socket" as being something conceptually "above" the low-level transport mechanisms.
bv
@bv:matrix.org
[m]
mapped, yes. but it is a one-to-many map. A single zeromq socket instance can simultaneously be a "front" for multiple transports.
y2022
@y2022:anonymousland.org
[m]

I'm trying to understand the PUB and SUB pattern in C++ and compiled the example codes in https://zeromq.org/socket-api/#publish-subscribe-pattern.
After I run both the publisher and the subscriber, the subscriber throws an assertion error:

$ ./sub
sub: sub.cpp:27: int main(): Assertion `*result == 2' failed.
Aborted (core dumped)

The function recv_multipart returns 1 instead 2. What did I do wrong?

bv
@bv:matrix.org
[m]
I don't see any example code
1 reply
bv
@bv:matrix.org
[m]
I'm not sure why that assert() fired. My only wild guess is that some other code has bind()'ed to tcp://localhost:5555. This kind of thing has happened to me when I test random stuff and unintentionally leave an application running.
1 reply
y2022
@y2022:anonymousland.org
[m]
How about this warning from https://github.com/booksbyus/zguide/blob/master/examples/C%2B%2B/syncpub.cpp, how can I fix this warning using the version 4.7.0?
syncpub.cpp:17:26: warning: ‘void zmq::detail::socket_base::setsockopt(int, const void*, size_t)’ is deprecated: from 4.7.0, use `set` taking option from zmq::sockopt [-Wdeprecated-declarations]
   17 |     publisher.setsockopt (ZMQ_SNDHWM, &sndhwm, sizeof (sndhwm));
      |     ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bv
@bv:matrix.org
[m]
FWIW, I reproduce the assert()
the compiler warning is apparently due to the syncpub.cpp using a deprecated API. As the warning says, the code should be using the set() method instead of setsockopt().
bv
@bv:matrix.org
[m]
that send() loop in the "pub" example seems both broken and not consistent with the comments
if you change the zmq::send_flags::none to zmq::send_flags:sndmore you will get expected behavior.
1 reply
bv
@bv:matrix.org
[m]
zeromq/zeromq.org#134 results in "all checks fail", but I suspect their failures are not related to my changes
y2022
@y2022:anonymousland.org
[m]
I would like to replace the deprecated function and fix the compiler warnings of the example codes in https://github.com/booksbyus/zguide/blob/master/examples/C%2B%2B/syncpub.cpp and https://github.com/booksbyus/zguide/blob/master/examples/C%2B%2B/syncsub.cpp.
I modified the code as following:
//
//  Synchronized publisher in C++
//

#include <zmq.hpp>
#include <zmq_addon.hpp>
#include <iostream>
#include <chrono>
#include <thread>
//  We wait for 10 subscribers
#define SUBSCRIBERS_EXPECTED  1

int main () {
    zmq::context_t context(1);

    //  Socket to talk to clients
    zmq::socket_t publisher (context, zmq::socket_type::pub);
    publisher.bind("tcp://*:5561");

    //  Socket to receive signals
    zmq::socket_t syncservice (context, zmq::socket_type::rep);
    syncservice.bind("tcp://*:5562");

    //  Get synchronization from subscribers
    int subscribers = 0;
    while (subscribers < SUBSCRIBERS_EXPECTED) {
        zmq::message_t message;
        //  - wait for synchronization request
        syncservice.recv(message, zmq::recv_flags::none);

        //  - send synchronization reply
        zmq::message_t reply;
        syncservice.send (reply, zmq::send_flags::none);


        subscribers++;
    }
    // Give the subscribers a chance to connect, so they don't lose any messages

    // std::this_thread::sleep_for(std::chrono::milliseconds(20));

    std::cout << "Start broadcasting\n";
    //  Now broadcast exactly 1M updates followed by END
    int update_nbr;
    for (update_nbr = 0; update_nbr < 1000; update_nbr++) {    
        publisher.send (zmq::str_buffer("SYNC"), zmq::send_flags::sndmore);
        publisher.send(zmq::str_buffer("Rhubarb"));
    }
    publisher.send (zmq::str_buffer(""), zmq::send_flags::sndmore);
    publisher.send (zmq::str_buffer("END"));

    //  Give 0MQ time to flush output
    std::this_thread::sleep_for(std::chrono::seconds(1));
    return 0;
}
//
//  Synchronized subscriber in C++
//

#include <zmq.hpp>
#include <zmq_addon.hpp>
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main (int argc, char *argv[])
{
   zmq::context_t context(1);

    //  First, connect our subscriber socket
    zmq::socket_t subscriber (context, zmq::socket_type::sub);
    subscriber.connect("tcp://localhost:5561");
    subscriber.set(zmq::sockopt::subscribe, "");

    //  Second, synchronize with publisher
    zmq::socket_t syncclient (context, zmq::socket_type::req);
    syncclient.connect("tcp://localhost:5562");
    std::cout << "Send\n";
    //  - send a synchronization request
    zmq::message_t request;
    syncclient.send (request, zmq::send_flags::none);

    //  - wait for synchronization reply
    //  Get the reply.
    zmq::message_t reply;
    syncclient.recv (reply, zmq::recv_flags::none);
    std::cout << "Got reply\n";
    //  Third, get our updates and report how many we got
    int update_nbr = 0;
    auto start = high_resolution_clock::now();
    while (1) {
               // Receive all parts of the message
        std::vector<zmq::message_t> recv_msgs;
        zmq::recv_result_t result =
        zmq::recv_multipart(subscriber, std::back_inserter(recv_msgs));
        assert(result && "recv failed");
        assert(*result == 2);

        if (recv_msgs[1].to_string().compare("END") == 0) {
            break;
        }
        // std::cout << "Received " <<recv_msgs[0].to_string()<<" "<<update_nbr<<std::endl;
        update_nbr++;
    }
    std::cout << "Received " << update_nbr << " updates" << std::endl;
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);

// To get the value of duration use the count()
// member function on the duration object
std::cout << duration.count() << std::endl;
    return 0;
}
y2022
@y2022:anonymousland.org
[m]
Unfortunately, the execution time differs very huge. For 1000 iteration pf the broadcast messages, the original code in master prints out on my computer +- 200 us. My new modification prints out +- 3680 us. Can someone explain the reason?
AliOzeir12
@AliOzeir12
Hello, hope all is doing well, i want to ask a question regarding setting up plain authentication to a pub/sub pattern in zeromq@6.0.0-beta.16 in NodeJS, is that possible?
Fabrice Bacchella
@fbacchella
using ZAP ?
AliOzeir12
@AliOzeir12
Fabrice Bacchella
@fbacchella
that’s protocol used to negotiate login/password authentication
but to check those password on server side, ZAP is needed
at least in libzmq, perhaps js provides something else
AliOzeir12
@AliOzeir12
can you give more context about that, since i am using this package https://www.npmjs.com/package/zeromq?activeTab=readme, and there's no mention for ZAP inside it
Fabrice Bacchella
@fbacchella
grep this string inproc://zeromq.zap.01 inside the source code
is mandatory to have ZAP running
AliOzeir12
@AliOzeir12
it seems that yeah ZAP is mandatory but i don't know to include ZAP in nodejs, i think this is a deprated package and it seems not working https://www.npmjs.com/package/zmq-zap
anyone have any idea on how to set up ZAP in nodejs or any alternative options to setup PLAIN authentication?
Fabrice Bacchella
@fbacchella
js being a dynamic langage, it shoud not be to hard to add hook
bv
@bv:matrix.org
[m]
Implementing ZAP seems to me to be often left to the end developer, though some library support exists in various languages. If you haven't already, I suggest you read the series of blog posts by Hintjens http://hintjens.com/blog:48. They introduce the different "houses" level of security which are good to guide how you might implement ZAP.
I've implemented some of the "houses" on top of cppzmq. It takes a little work to figure out what to do but it is a relatively simple application of ZeroMQ patterns
Fabrice Bacchella
@fbacchella
In the librarie, there is an example that uses zap: test/unit/socket-zap-test.ts
John Goetz
@johngoetz_gitlab
Hi all, is there a release shedule for libzmq or a set list of bugs and features that the next release is waiting on? Last release was 2 years ago this week and there are features that I would like to use, though I'm hesitant to use the master branch directly.
This question has been asked here a couple times over the past couple years without a response and so I think perhaps the people in charge of releases do not monitor this channel.
I appologize in advance, but I will "double-post" this question to the zeromq-dev mailing list.
Fabrice Bacchella
@fbacchella
all the zmq is in a strange state
still active, but with no real project
Oscar Frith-Macdonald
@OscarF-M_gitlab

Does anyone have working versions of the clone examples in C? In particular I am trying to get model 5 working and the use of subtrees, I have updated them to run, but I don't believe they are working correctly.
In clonecli5.c there are the lines:

zsocket_set_subscribe (subscriber, "");
zsocket_connect (subscriber, "tcp://localhost:5557");
zsocket_set_subscribe (subscriber, SUBTREE);

I have updated these to the following:

zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", 0);
zmq_connect(subscriber, "tcp://localhost:5557");
zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "SUBTREE", sizeof(SUBTREE));

The line: zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", 0);
means that all messages are received, and no filtering is done. This can be seen when I start multiple clients with different subtrees and all messages are received.

I assumed if I took out the subscribe to all topics line, and just left in: zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "SUBTREE", sizeof(SUBTREE));
then only the specific SUBTREE topic would be received. Instead, nothing is received.

Fabrice Bacchella
@fbacchella
what does sizeof(SUBTREE) is supposed to return ?
Oscar Frith-Macdonald
@OscarF-M_gitlab
@fbacchella the size of SUBTREE which is defined at the start:
#define SUBTREE "/client/"
Fabrice Bacchella
@fbacchella
sizeof is not strlen
Oscar Frith-Macdonald
@OscarF-M_gitlab
No change when using strlen
Oscar Frith-Macdonald
@OscarF-M_gitlab
Solved: took SUBTREE out of quotes, e.g.
zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, SUBTREE, strlen(SUBTREE));