概述
//
//Request-reply service in C++
//Connects REP socket to tcp://localhost:5560
//Expects "Hello" from client, replies with "World"
//
// Olivier Chamoux <olivier.chamoux@fr.thalesgroup.com>
#include "zhelpers.hpp"
int main (int argc,char *argv[])
{
zmq::context_t context(1);
zmq::socket_t responder(context, ZMQ_REP);
responder.connect("tcp://localhost:5560");
while(1)
{
//Wait for next request from client
std::string string= s_recv (responder);
std::cout<< "Received request: " << string<< std::endl;
// Do some 'work'
sleep (1);
//Send reply back to client
s_send (responder, "World");
}
}
最后
以上就是迷你帆布鞋为你收集整理的继
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复