欢迎来到天天文库
浏览记录
ID:31613295
大小:65.96 KB
页数:3页
时间:2019-01-16
《zeromq初体验》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、1安装1.1下载源码http://www.zeromq.org/intro:get-the-software,注意区分操作系统,我这里下载的是POSIX版本,如图示:1.2把源码上传到服务器,开始安装1.2.1解压源码包tarzxvfzeromq-3.2.1-rc2.tar.gz1.2.2编译及安装源码包1)./configure--prefix=/usr/local/zeromq注意:红色部分为你想把zeroMQ安装到哪儿的目录,默认将安装到/usr/local/include/、/usr/local/lib/下2)make3)makeinstall1测试1.1下载官方demo源码http
2、s://github.com/imatix/zguide/tree/master/examples/1.2编译demoDemo包里有包括C、C++、Java等很多语言的相应源码demo,我这里以C++为例。步骤如下:1)cdimatix-zguide-ac706e5/examples/C++2)ls-tlhrhw*.cpp3)g++-g-Wall-fPIC-lstdc++-lzmqhwserver.cpp-oserver4)g++-g-Wall-fPIC-lstdc++-lzmqhwclient.cpp-oclient注意:如果在编译过程中报错找不到zmq.hpp文件,你可以在下面的网站中找
3、到https://github.com/zeromq/cppzmq将zmq.hpp拷贝到/usr/local/include/即可。1.3运行demo[liao@localhostC++]$./serverReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHelloReceivedHello[liao@localhostC++]$./clientConnectingtohelloworldserver...Sending
4、Hello0...ReceivedWorld0SendingHello1...ReceivedWorld1SendingHello2...ReceivedWorld2SendingHello3...ReceivedWorld3SendingHello4...ReceivedWorld4SendingHello5...ReceivedWorld5SendingHello6...ReceivedWorld6SendingHello7...ReceivedWorld7SendingHello8...ReceivedWorld8SendingHello9...ReceivedWorld9大功告成,哥
5、们你已经入门了,O(∩_∩)O哈哈~。此外,你可以在下面的网页中找zeroMQ的各种模式demo。http://zguide.zeromq.org/page:all
此文档下载收益归作者所有