资源简介

zeromq的request-reply问答模式的jave实现,Eclipse下的maven工程,相关引用已在pom文件引入,可以直接运行。

资源截图

代码片段和文件信息

package Request;

import org.zeromq.ZMQ;

public class RequestClient {
 public static void main(String[] args) {
        ZMQ.Context context = ZMQ.context(1);

        //  Socket to talk to server
        System.out.println(“Connecting to hello world server…“);

        ZMQ.Socket requester = context.socket(ZMQ.REQ);
        requester.connect(“tcp://localhost:5555“);

        for (int requestNbr = 0; requestNbr != 100; requestNbr++) {
            String request = “Hello“;
            System.out.println(“Sending Hello “ + requestNbr);
            requester.send(request.getBytes() 0);

            byte[] reply = requester.recv(0);
            System.out.println(“Received “ + new String(reply) + “ “ + requestNbr);
        }
        requester.close();
        context.term();
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1431  2017-02-10 09:15  com.zeromq.req-rep\.classpath

     文件        570  2017-02-10 09:15  com.zeromq.req-rep\.project

     文件        243  2017-02-10 09:15  com.zeromq.req-rep\.settings\org.eclipse.jdt.core.prefs

     文件         90  2017-02-10 09:15  com.zeromq.req-rep\.settings\org.eclipse.m2e.core.prefs

     文件        545  2017-02-10 09:29  com.zeromq.req-rep\pom.xml

     文件        834  2017-02-10 09:32  com.zeromq.req-rep\src\main\java\Request\RequestClient.java

     文件        810  2017-02-10 09:31  com.zeromq.req-rep\src\main\java\Response\ResponseServer.java

     文件        108  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\MANIFEST.MF

     文件        243  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\maven\com.zeromq\com.zeromq.req-rep\pom.properties

     文件        545  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\maven\com.zeromq\com.zeromq.req-rep\pom.xml

     文件       1603  2017-02-10 09:32  com.zeromq.req-rep\target\classes\Request\RequestClient.class

     文件       1446  2017-02-10 09:31  com.zeromq.req-rep\target\classes\Response\ResponseServer.class

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\maven\com.zeromq\com.zeromq.req-rep

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\maven\com.zeromq

     目录          0  2017-02-10 09:28  com.zeromq.req-rep\src\main\java\Request

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\src\main\java\Response

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF\maven

     目录          0  2017-02-10 09:28  com.zeromq.req-rep\src\main\java

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src\main\resources

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src\test\java

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src\test\resources

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\meta-INF

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\Request

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes\Response

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src\main

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src\test

     目录          0  2017-02-10 09:29  com.zeromq.req-rep\target\classes

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\target\test-classes

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\.settings

     目录          0  2017-02-10 09:15  com.zeromq.req-rep\src

............此处省略5个文件信息

评论

共有 条评论