Beispiel #1
0
void *
zsocket_new (zctx_t *ctx, int type)
{
    void *socket = zctx__socket_new (ctx, type);
    if (type == ZMQ_SUB)
        zsockopt_set_subscribe (socket, "");
    return socket;
}
Beispiel #2
0
Datei: zctx.c Projekt: calid/czmq
void *
zctx__socket_pipe (zctx_t *self)
{
    assert (self);
    void *pipe = zctx__socket_new (self, ZMQ_PAIR);
    if (pipe)
        zsocket_set_hwm (pipe, self->pipehwm);
    return pipe;
}
Beispiel #3
0
void
zctx_test (bool verbose)
{
    printf (" * zctx: ");

    //  @selftest
    //  Create and destroy a context without using it
    zctx_t *ctx = zctx_new ();
    assert (ctx);
    zctx_destroy (&ctx);
    assert (ctx == NULL);

    //  Create a context with many busy sockets, destroy it
    ctx = zctx_new ();
    assert (ctx);
    zctx_set_iothreads (ctx, 1);
    zctx_set_linger (ctx, 5);       //  5 msecs
    void *s1 = zctx__socket_new (ctx, ZMQ_PAIR);
    void *s2 = zctx__socket_new (ctx, ZMQ_XREQ);
    void *s3 = zctx__socket_new (ctx, ZMQ_REQ);
    void *s4 = zctx__socket_new (ctx, ZMQ_REP);
    void *s5 = zctx__socket_new (ctx, ZMQ_PUB);
    void *s6 = zctx__socket_new (ctx, ZMQ_SUB);
    zsocket_connect (s1, "tcp://127.0.0.1:5555");
    zsocket_connect (s2, "tcp://127.0.0.1:5555");
    zsocket_connect (s3, "tcp://127.0.0.1:5555");
    zsocket_connect (s4, "tcp://127.0.0.1:5555");
    zsocket_connect (s5, "tcp://127.0.0.1:5555");
    zsocket_connect (s6, "tcp://127.0.0.1:5555");
    assert (zctx_underlying (ctx));
    zctx_destroy (&ctx);
    //  @end

    printf ("OK\n");
}
Beispiel #4
0
void *
zsocket_new (zctx_t *ctx, int type)
{
    void *self = zctx__socket_new (ctx, type);
    return self;
}
Beispiel #5
0
void *
zsocket_new (zctx_t *ctx, int type)
{
    void *socket = zctx__socket_new (ctx, type);
    return socket;
}