hi all, i am using zactor and in the call back i receive a pipe socket. i create a router socket and polling this sockets for messages. it is not working and giving -1 result as return value of zmq_poll; what could be the problem? void echo_actor (zsock_t *pipe, void *args) { // need to implement...? printf("thread id : %lu", GetCurrentThreadId()); server_t* self = server_new(pipe); zmq_pollitem_t items[] = { { self->pipe, 0, ZMQ_POLLIN, 0 }, { self->router, 0, ZMQ_POLLIN, 0 } }; self->monitor_at = zclock_time() + self->monitor; while (!self->stopped && !zctx_interrupted) { // Calculate tickless timer, up to interval seconds uint64_t tickless = zclock_time() + self->monitor; uint64_t diff = (tickless - zclock_time()) * ZMQ_POLL_MSEC; // Poll until at most next timer event int rc = zmq_poll(items, 2, diff ); if (rc == -1) { break; // Context has been shut down }
// Process incoming message from either socket if (items[0].revents & ZMQ_POLLIN) server_control_message(self); if (items[1].revents & ZMQ_POLLIN) server_client_message(self); // If clock went past timeout, then monitor server if (zclock_time() >= self->monitor_at) { printf("clock went past timeout, need to monitor the server"); } } server_destroy(&self); } int main() { zactor_t *actor = zactor_new (echo_actor, "Hello, World"); assert (actor); zstr_sendx (actor, "ECHO", "This is a string", NULL); char *string = zstr_recv (actor); fprintf(stdout,"%s\n",string); assert (streq (string, "This is a string")); free (string); zactor_destroy (&actor); }
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org https://lists.zeromq.org/mailman/listinfo/zeromq-dev