48 ss << countdown <<
"...";
53 zio::multipart_t mmsg(ss.str());
54 client.
send(
"echo", mmsg);
63 ss <<
"countdown echo [" << mmsg.size() <<
"]:";
65 ss <<
"\n\t" << mmsg.popstr();
72 auto res = link.recv(die);
77 void doit(
int serverish,
int clientish,
int nclients,
int nworkers)
80 ss<<
"main doit("<<serverish<<
","<<clientish<<
","<<nworkers<<
","<<nclients<<
")";
84 std::string broker_address =
"tcp://127.0.0.1:5555";
86 std::vector<zio::zactor_t*> clients;
87 std::vector<std::pair<std::string, zio::zactor_t*> > actors;
101 actors.push_back({
"client",
client});
102 clients.push_back(
client);
105 for (
auto client : clients) {
108 auto res =
client->link().recv(done);
112 for (
auto it = actors.rbegin(); it != actors.rend(); ++it) {
113 zio::debug(
"main terminate actor " + it->first);
121 int main(
int argc,
char* argv[])
125 std::string which =
"server";
132 nclients = atoi(argv[2]);
136 nworkers = atoi(argv[3]);
139 if (which ==
"server") {
140 doit(ZMQ_SERVER, ZMQ_CLIENT, nclients, nworkers);
143 doit(ZMQ_ROUTER, ZMQ_DEALER, nclients, nworkers);
int main(int argc, char *argv[])
size_t send(const void *buf_, size_t len_, int flags_=0)
void echo_worker(zio::socket_t &link, std::string address, int socktype)
void doit(int serverish, int clientish, int nclients, int nworkers)
void broker_actor(zio::socket_t &link, std::string address, int socktype)
void countdown_echo(zio::socket_t &link, std::string address, int socktype)
void client(std::string str)
void recv(zio::multipart_t &reply)
void send(std::string service, zio::multipart_t &request)