Example #1
0
static
zsock_t* subscriber_pull_socket_new(zconfig_t* config)
{
    zsock_t *socket = zsock_new(ZMQ_PULL);
    assert(socket);
    zsock_set_linger(socket, 0);
    zsock_set_reconnect_ivl(socket, 100); // 100 ms
    zsock_set_reconnect_ivl_max(socket, 10 * 1000); // 10 s

    char *pull_spec = zconfig_resolve(config, "frontend/endpoints/subscriber/pull", "tcp://*");
    char *full_spec = augment_zmq_connection_spec(pull_spec, pull_port);
    if (!quiet)
        printf("[I] subscriber: binding PULL socket to %s\n", full_spec);
    int rc = zsock_bind(socket, "%s", full_spec);
    assert(rc != -1);
    free(full_spec);

    const char *inproc_binding = "inproc://subscriber-pull";
    if (!quiet)
        printf("[I] subscriber: binding PULL socket to %s\n", inproc_binding);
    rc = zsock_bind(socket, "%s", inproc_binding);
    assert(rc != -1);

    return socket;
}
Example #2
0
static
zsock_t* subscriber_router_socket_new(zconfig_t* config)
{
    zsock_t *socket = zsock_new(ZMQ_ROUTER);
    assert(socket);
    zsock_set_linger(socket, 0);
    zsock_set_reconnect_ivl(socket, 100); // 100 ms
    zsock_set_reconnect_ivl_max(socket, 10 * 1000); // 10 s

    char *router_spec = zconfig_resolve(config, "frontend/endpoints/subscriber/router", "tcp://*");
    char *full_spec = augment_zmq_connection_spec(router_spec, router_port);
    if (!quiet)
        printf("[I] subscriber: binding ROUTER socket to %s\n", full_spec);
    int rc = zsock_bind(socket, "%s", full_spec);
    assert(rc != -1);
    free(full_spec);

    return socket;
}
Example #3
0
static
zsock_t* subscriber_sub_socket_new(zconfig_t* config, zlist_t* devices)
{
    zsock_t *socket = zsock_new(ZMQ_SUB);
    assert(socket);
    zsock_set_rcvhwm(socket, rcv_hwm);
    zsock_set_linger(socket, 0);
    zsock_set_reconnect_ivl(socket, 100); // 100 ms
    zsock_set_reconnect_ivl_max(socket, 10 * 1000); // 10 s

    // connect socket to endpoints
    char* spec = zlist_first(devices);
    while (spec) {
        if (!quiet)
            printf("[I] subscriber: connecting SUB socket to: %s\n", spec);
        int rc = zsock_connect(socket, "%s", spec);
        log_zmq_error(rc, __FILE__, __LINE__);
        assert(rc == 0);
        spec = zlist_next(devices);
    }

    return socket;
}
Example #4
0
///
//  Set socket option `reconnect_ivl_max`.
void QZsock::setReconnectIvlMax (int reconnectIvlMax)
{
    zsock_set_reconnect_ivl_max (self, reconnectIvlMax);
    
}
Example #5
0
JNIEXPORT void JNICALL
Java_org_zeromq_czmq_Zsock__1_1setReconnectIvlMax (JNIEnv *env, jclass c, jlong self, jint reconnect_ivl_max)
{
    zsock_set_reconnect_ivl_max ((zsock_t *) (intptr_t) self, (int) reconnect_ivl_max);
}