您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ zmsg_popstr函数代码示例

51自学网 2021-06-03 12:01:44
  C++
这篇教程C++ zmsg_popstr函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中zmsg_popstr函数的典型用法代码示例。如果您正苦于以下问题:C++ zmsg_popstr函数的具体用法?C++ zmsg_popstr怎么用?C++ zmsg_popstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了zmsg_popstr函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: zyre_handler

static intzyre_handler (zloop_t *loop, zsock_t *reader, void *argument){    server_t *self = (server_t *) argument;    zmsg_t *msg = zyre_recv (self->zyre);    if (!msg)        return -1;              //  Interrupted    char *command = zmsg_popstr (msg);    char *peer_id = zmsg_popstr (msg);    char *peer_name = zmsg_popstr (msg);    if (streq (command, "ENTER"))        zsys_info ("ZPIPES server appeared at %s", peer_name);    else    if (streq (command, "EXIT"))        zsys_info ("ZPIPES server vanished from %s", peer_name);    else    if (streq (command, "SHOUT")) {        char *group = zmsg_popstr (msg);        if (streq (group, "ZPIPES"))            server_process_cluster_command (self, peer_id, peer_name, msg, false);        zstr_free (&group);    }    else    if (streq (command, "WHISPER"))        server_process_cluster_command (self, peer_id, peer_name, msg, true);        zstr_free (&command);    zstr_free (&peer_id);    zstr_free (&peer_name);    zmsg_destroy (&msg);        return 0;}
开发者ID:henrycpp,项目名称:zbroker,代码行数:35,


示例2: s_node_recv

static bools_node_recv (zre_node_t *node, char* command, char* expected){    bool result = false;    zmsg_t *incoming = zre_node_recv (node);    assert (incoming);    char *event = zmsg_popstr (incoming);    if (streq (event, command)) {        char *peer = zmsg_popstr (incoming);        char *group = NULL;        if (streq (command, "SHOUT"))            group = zmsg_popstr (incoming);        char *cookie = zmsg_popstr (incoming);        if (streq (cookie, expected)) {            result = true;        }        free (peer);        if (group)            free (group);        free (cookie);    }    free (event);    zmsg_destroy (&incoming);    return result;}
开发者ID:Aluminus,项目名称:zyre,代码行数:31,


示例3: pthread_self

/** *  * @param foundId * @param foundReply * @return  */bool BoomStick::ReadFromReadySocket(std::string& foundId, std::string& foundReply) {   if (0 == mUtilizedThread) {      mUtilizedThread = pthread_self();   } else {      CHECK(pthread_self() == mUtilizedThread);   }   if (!mChamber) {      LOG(WARNING) << "Invalid socket";      return false;   }   bool success = false;   zmsg_t* msg = zmsg_recv(mChamber);   if (!msg) {      foundReply = zmq_strerror(zmq_errno());   } else if (zmsg_size(msg) == 2) {      char* msgChar;      msgChar = zmsg_popstr(msg);      foundId = msgChar;      free(msgChar);      msgChar = zmsg_popstr(msg);      foundReply = msgChar;      free(msgChar);      success = true;   } else {      foundReply = "Malformed reply, expecting 2 parts";   }   if (msg) {      zmsg_destroy(&msg);   }   return success;}
开发者ID:KjellKod,项目名称:QueueNado,代码行数:39,


示例4: server_method

static zmsg_t *server_method (server_t *self, const char *method, zmsg_t *msg){    //  Connect to a remote    zmsg_t *reply = NULL;    if (streq (method, "CONNECT")) {        char *endpoint = zmsg_popstr (msg);        assert (endpoint);        server_connect (self, endpoint);        zstr_free (&endpoint);    }    else    if (streq (method, "PUBLISH")) {        char *key = zmsg_popstr (msg);        char *value = zmsg_popstr (msg);        server_accept (self, key, value);        zstr_free (&key);        zstr_free (&value);    }    else    if (streq (method, "STATUS")) {        //  Return number of tuples we have stored        reply = zmsg_new ();        assert (reply);        zmsg_addstr (reply, "STATUS");        zmsg_addstrf (reply, "%d", (int) zhashx_size (self->tuples));    }    else        zsys_error ("unknown zgossip method '%s'", method);    return reply;}
开发者ID:Cargo-Labs,项目名称:czmq,代码行数:32,


示例5: s_recv_from_zyre

static ints_recv_from_zyre (s_agent_t *self){    zyre_event_t *event = zyre_event_new (self->zyre);    if (zyre_event_type (event) == ZYRE_EVENT_SHOUT    && streq (zyre_event_group (event), "DROPS")) {        zmsg_t *msg = zyre_event_msg (event);        char *operation = zmsg_popstr (msg);                if (streq (operation, "CREATE")) {            char *filename = zmsg_popstr (msg);            zframe_t *frame = zmsg_pop (msg);            zfile_t *file = zfile_new (self->path, filename);            zfile_output (file);            fwrite (zframe_data (frame), 1, zframe_size (frame), zfile_handle (file));            zfile_destroy (&file);            zframe_destroy (&frame);            zstr_send (self->pipe, filename);            free (filename);        }        free (operation);    }    zyre_event_destroy (&event);    return 0;}
开发者ID:edgenet,项目名称:drops,代码行数:25,


示例6: get_request

int get_request(zsock_t *sock, struct request *req) {    zmsg_t *msg;    int size;    char *str;    int Y, m, d, H, M, S;    struct tm tm;    msg = zmsg_recv(sock);    size = zmsg_size(msg);    if (size != 2) {        // something's wrong        zmsg_destroy(&msg);        return -1;    }    str = zmsg_popstr(msg);    req->ip = inet_addr(str);    str = zmsg_popstr(msg);    sscanf(str, "%04d%02d%02d%02d%02d%02d", &Y, &m, &d, &H, &M, &S);    tm.tm_year = Y - 1900;    tm.tm_mon = m;    tm.tm_mday = d;    tm.tm_hour = H;    tm.tm_min = M;    tm.tm_sec = S;    req->timestamp = mktime(&tm);    zmsg_destroy(&msg);    return 0;}
开发者ID:hugolu,项目名称:learn-zmq,代码行数:31,


示例7: server_process_cluster_command

static voidserver_process_cluster_command (    server_t *self,    const char *peer_id,    const char *peer_name,    zmsg_t *msg,    bool unicast){    char *request = zmsg_popstr (msg);    char *pipename = zmsg_popstr (msg);    zsys_info ("peer=%s command=%s pipe=%s unicast=%d",                peer_name, request, pipename? pipename: "-", unicast);    //  Lookup or create pipe    //  TODO: remote pipes need cleaning up with some timeout    pipe_t *pipe = NULL;    if (pipename) {        pipe = (pipe_t *) zhash_lookup (self->pipes, pipename);        if (!pipe)            pipe = pipe_new (self, pipename);    }    if (pipe && streq (request, "HAVE WRITER"))        pipe_attach_remote_writer (pipe, peer_id, unicast);    else    if (pipe && streq (request, "HAVE READER"))        pipe_attach_remote_reader (pipe, peer_id, unicast);    else    if (pipe && streq (request, "DATA")) {        //  TODO encode these commands as proper protocol        zframe_t *frame = zmsg_pop (msg);        zchunk_t *chunk = zchunk_new (zframe_data (frame), zframe_size (frame));        if (pipe->writer == REMOTE_NODE && pipe->reader) {            zsys_info ("send %d bytes to pipe", (int) zchunk_size (chunk));            pipe_send_data (pipe, &chunk);         }        else            zsys_info ("discard %d bytes, unroutable", (int) zchunk_size (chunk));                    zframe_destroy (&frame);        zchunk_destroy (&chunk);    }    else    if (pipe && streq (request, "DROP READER"))        pipe_drop_remote_reader (&pipe, peer_id);    else    if (pipe && streq (request, "DROP WRITER"))        pipe_drop_remote_writer (&pipe, peer_id);    else    if (streq (request, "DUMP"))        zyre_dump (self->zyre);    else        zsys_warning ("bad request %s from %s", request, peer_name);    zstr_free (&pipename);    zstr_free (&request);}
开发者ID:henrycpp,项目名称:zbroker,代码行数:56,


示例8: s_agent_handle_control

static ints_agent_handle_control (agent_t *self){    //  Get the whole message off the control socket in one go    zmsg_t *request = zmsg_recv (self->control);    char *command = zmsg_popstr (request);    if (!command)        return -1;                  //  Interrupted    if (streq (command, "SET")) {        char *name = zmsg_popstr (request);        char *value = zmsg_popstr (request);        curve_codec_set_metadata (self->codec, name, value);        free (name);        free (value);    }    else    if (streq (command, "CONNECT")) {        assert (!self->endpoint);        self->endpoint = zmsg_popstr (request);        int rc = zsocket_connect (self->dealer, "%s", self->endpoint);        assert (rc != -1);        zframe_t *server_key = zmsg_pop (request);        zframe_t *output = curve_codec_execute (self->codec, &server_key);        zframe_send (&output, self->dealer, 0);        self->state = connecting;    }    else    if (streq (command, "DISCONNECT")) {        if (self->endpoint) {            int rc = zsocket_disconnect (self->dealer, "%s", self->endpoint);            assert (rc != -1);            free (self->endpoint);        }    }    else    if (streq (command, "VERBOSE")) {        char *verbose = zmsg_popstr (request);        curve_codec_set_verbose (self->codec, *verbose == '1');        free (verbose);    }    else    if (streq (command, "TERMINATE")) {        self->state = terminated;        zstr_send (self->control, "OK");    }    else {        puts ("E: invalid command from API");        assert (false);    }    free (command);    zmsg_destroy (&request);    return 0;}
开发者ID:zeromq,项目名称:libcurve,代码行数:54,


示例9: s_self_configure

static voids_self_configure (self_t *self, zsock_t **sock_p, zmsg_t *request, char *name){    char *type_name = zmsg_popstr (request);    char *endpoints = zmsg_popstr (request);    if (self->verbose)        zsys_info ("zmonitor: - %s type=%s attach=%s", name, type_name, endpoints);    assert (*sock_p == NULL);    *sock_p = s_create_socket (type_name, endpoints);    assert (*sock_p);    zpoller_add (self->poller, *sock_p);    zstr_free (&type_name);    zstr_free (&endpoints);}
开发者ID:wangxx2026,项目名称:czmq,代码行数:14,


示例10: malloc

process_item *utils_msg2processitem(zmsg_t *message){  process_item *item = malloc(sizeof(process_item));  char *msgid = zmsg_popstr(message);  char *command = zmsg_popstr(message);  zframe_t *frame = zmsg_pop(message);  pid_t *pid = (pid_t*)frame;  memcpy(&item->pid,pid,sizeof(pid_t));  item->message_id = msgid;  item->command = command;  return item;}
开发者ID:GoogleLonely,项目名称:satan,代码行数:14,


示例11: s_alerts

static voids_alerts (    zsock_t *pipe,    void *args) {    const char *name = "ALERT";    mlm_client_t *cl = mlm_client_new ();    mlm_client_connect (cl, endpoint, 5000, __PRETTY_FUNCTION__);    mlm_client_set_producer (cl, stream);    zsock_t *msgpipe = mlm_client_msgpipe (cl);    zpoller_t *poller = zpoller_new (pipe, msgpipe, NULL);    char *alert_state = strdup ("NEW");    zsock_signal (pipe, 0);    while (!zsys_interrupted) {        zsock_t *which = zpoller_wait (poller, 1000);        if (!which) {            mlm_client_sendx (cl, "alert://[email
C++ zmsg_pushstr函数代码示例
C++ zmsg_new函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。