当前位置: 首页 > news >正文

深圳较便宜的网站建设0基础学习网站开发

深圳较便宜的网站建设,0基础学习网站开发,网站开发深圳公司,龙岗微信网站制作1. 本程序功能 1) 要有完整的request 和 response; 2) 支持多进程并行处理任务#xff1b; 3)子进程任务结束后无僵尸进程 2.Apache Thrift C库的编译和安装 见 步步详解#xff1a;Apache Thrift C库从编译到工作模式DEMO_北雨南萍的博客-CSDN博客 3.框架生成 数据字…1. 本程序功能  1) 要有完整的request  和 response; 2) 支持多进程并行处理任务 3)子进程任务结束后无僵尸进程 2.Apache Thrift C库的编译和安装 见 步步详解Apache Thrift C库从编译到工作模式DEMO_北雨南萍的博客-CSDN博客 3.框架生成 数据字段定义 cat Datainfo.thrift # Datainfo.thrift struct message   {     1:i32 seqId,     2:string content   }      struct response {   1:i32 seqId,   2:string content } service serDemo   {     response put(1:message msg)   }  thrift -gen cpp Datainfo.thrift 4.Server端源码 serDemo_server.skeleton.cpp // This autogenerated skeleton file illustrates how to build a server. // You should copy it to another filename to avoid overwriting it.#include stdio.h #include stdlib.h #include unistd.h #include sys/types.h #include sys/wait.h#include iostream #include stdexcept #include thread#include serDemo.h#include thrift/concurrency/ThreadManager.h #include thrift/concurrency/ThreadFactory.h #include thrift/concurrency/ThreadManager.h #include thrift/protocol/TBinaryProtocol.h #include thrift/server/TSimpleServer.h #include thrift/server/TThreadPoolServer.h #include thrift/transport/TSocket.h #include thrift/transport/TServerSocket.h #include thrift/transport/TBufferTransports.husing namespace ::apache::thrift; using namespace ::apache::thrift::concurrency; using namespace ::apache::thrift::protocol; using namespace ::apache::thrift::transport; using namespace ::apache::thrift::server;void handler(int num) {//我接受到了SIGCHLD的信号啦int status;int pid waitpid(-1,status,WNOHANG);if(WIFEXITED(status)) {printf(The child exit with code %d\n,WEXITSTATUS(status));} }class serDemoHandler : virtual public serDemoIf {public:serDemoHandler() {// 构造函数:用于初始任务处理句柄对象}void put(response _return, const message msg) {// Your implementation goes hereprintf(put starting ...\n);printf(receive message: id: %d, content: %s\n, msg.seqId, msg.content.c_str());char* ffmpeg_argv[]{/ffmpeg,-i,/opt/videoroom-1234-user-161756615651626-1615963571436156-video.mp4,-t,60,-vcodec,libx264,-f,flv,-y,/opt/videoroom-1234-user-161756615651626-1615963571436156-video.flv,NULL};printf(ffmpeg_argv:\n);for (int i 0; ffmpeg_argv[i] ! NULL; i) {printf(%s , ffmpeg_argv[i]);}printf(\n);pid_t pid fork();if (pid 0) {execvp(ffmpeg_argv[0], ffmpeg_argv);exit(0);} else if (pid 0) {printf(This is the parent process\n);} else {printf(Fork failed\n);}// 回复消息_return.seqId msg.seqId;_return.content This is the response message.;printf(put stopped.\n);}};int main(int argc, char **argv) {int port 19090;signal(SIGCHLD,handler);/*** TThreadPoolServer工作模式 ***/try {//创建一个线程管理器std::shared_ptrThreadManager threadManager ThreadManager::newSimpleThreadManager(16);std::shared_ptrThreadFactory threadFactory std::shared_ptrThreadFactory(new ThreadFactory());threadManager-threadFactory(threadFactory);threadManager-start();std::shared_ptrserDemoHandler handler(new serDemoHandler());std::shared_ptrTProcessor processor(new serDemoProcessor(handler));::std::shared_ptrTServerTransport serverTransport(new TServerSocket(port));::std::shared_ptrTTransportFactory transportFactory(new TBufferedTransportFactory());::std::shared_ptrTProtocolFactory protocolFactory(new TBinaryProtocolFactory());TThreadPoolServer server(processor, serverTransport, transportFactory, protocolFactory,threadManager);// 启动服务::std::cout Starting the TThreadPoolServer ... std::endl;server.serve();::std::cout Server stopped. std::endl;} catch (std::exception e) {std::cerr Error: e.what() std::endl;}return 0; } 编译生成server g -stdc11 -g -Wall  Datainfo_types.cpp serDemo.cpp serDemo_server.skeleton.cpp -o server -lthrift -lpthread   5. client端源码 client.cpp // 在同级目录下创建 client.cpp 文件 // ----------替换成自己的头文件---------- #include serDemo.h // -------------------------------------- #include thrift/transport/TSocket.h #include thrift/transport/TBufferTransports.h #include thrift/protocol/TBinaryProtocol.husing namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using boost::shared_ptr; int main(int argc, char **argv) { /* 不能用localhost, 否则会有运行时提示:* TSocket::open() connect() Host: localhost Port: 19090: Connection refused*///std::shared_ptrTSocket socket(new TSocket(localhost, 19090)); std::shared_ptrTSocket socket(new TSocket(127.0.0.1, 19090)); std::shared_ptrTTransport transport(new TBufferedTransport(socket)); std::shared_ptrTProtocol protocol(new TBinaryProtocol(transport));serDemoClient client(protocol); transport-open(); // ----------------------------我们的代码写在这里------------------------------ message msg; msg.seqId 1; msg.content client message; response response_put;client.put(response_put, msg); printf(seqId: %d, content: %s\n, response_put.seqId, response_put.content.c_str());//-------------------------------------------------------------------------- transport-close(); return 0; } 编译生成client g -stdc11 -g -Wall  Datainfo_types.cpp serDemo.cpp client.cpp -o client -lthrift -lpthread
http://wiki.neutronadmin.com/news/48419/

相关文章:

  • 网站域名列表深圳网站建设服务代码
  • 做ppt素材的网站有哪些深圳上市公司全部名单
  • 南京网站建设报价游戏网站建设平台
  • php网站建设考试网站建设专有名词
  • 教育网站安全建设方案全国电子网站建设
  • 上海优质网站seo有哪些廊坊视频优化价格
  • 企业建设一个自己的网站多少钱wordpress登陆账号
  • 清润邯郸网站局域网视频网站搭建
  • 绍兴优秀做网站的巩义网站建设费用多少
  • 网站建设的费用结构包括提供app开发公司报价
  • 肇庆城乡建设网站一级域名网站怎样收费的
  • 北京模板网站开发公司wordpress 无广告视频网站
  • 做h5比较好的网站一般淘宝网站做几个月赚钱
  • 网站网站制作开发需要哪些技术清廉企业建设
  • 宁波建设商城网站wordpress页面创建
  • 网站添加验证码网站织梦模板
  • 设计专业新手网站建设银行网站查询
  • 南京模板建站定制网站前程无忧网广州网站建设分类岗位
  • 酒店定房网站开发网站制作 知乎
  • 泸州网站建设报价网上购物系统流程图
  • 免费源代码网站html做的小网站
  • 内蒙古工程建设招投标中心网站怎样做国外能看到的网站
  • 沈阳 教育 公司 网站建设网站跟域名是什么关系
  • 派点网站建设视频网站开发的论文
  • 网站建设需求网网站推广工具有
  • 国内优秀的网站wordpress移除后台部分页面
  • 网站的制作建站人wordpress安装第二步
  • 重庆建网站公司自己建网站做外贸
  • 网站安全狗中小企业网络拓扑图绘制
  • 有什么网站可以做设计赚钱网络营销策略的制定