[zeromq-dev] ask for help

chengchunxiang chengchunxiang1986 at 126.com
Thu Oct 17 05:46:38 CEST 2013


    Hello lady or Gentleman! I'm a newer for zreomq.
    Today, I meet a problem when I ran a java program for zeromq on windows7 by the software--"myeclipse". I hava build the denpendent files by done all steps as the web site-- http://zeromq.org/bindings:java  wrote for windows, and then, I build a java project in "myeclipse",   cpoy the local_lat.java and remote.java two file into  the src file of the project, setup the library path(vaule is the path of zmp.jar file) , path(value is the paths of jzmq.dll file ,jzmq.lib file, libzmq.dll file , libzmq.lib file)  and arguments(value is "tcp://127.0.0.1:5000 1 100"), run local_lat.java , and then run remote.java , can out put the message:
                                                              message size: 1 [B]
                                                              roundtrip count: 100
                                                              mean latency: 110.0 [us]
   so i think the jzmq bind to java successfully . Now i write two programs, client.java and server.java, as follow:
client.java:
import java.io.*;
import org.zeromq.ZMQ;
public class client {
 /**
  * @param args
  */
 public static void main(String[] args){
        ZMQ.Context context = ZMQ.context(1);
        ZMQ.Socket socket = context.socket(ZMQ.PUSH);
        socket.connect("tcp://127.0.0.1:5001");        
        String str = "abcc";
        byte[] b = str.getBytes();
        socket.send(b,0);
        }
}

server.java
import java.io.*;
import org.zeromq.ZMQ;
public class server {
 /**
  * @param args
  */
  public static void main(String[] args){
         ZMQ.Context context = ZMQ.context(1);
         ZMQ.Socket socket = context.socket(ZMQ.PULL);
         socket.bind("tcp://127.0.0.1:5001");
         while(true){
          byte[] b = socket.recv(0);
          System.out.println(new String(b));
         }
     }
}

and setup the ibrary path  and path the same as  local_lat.java and remote.java except argument.They can be ran successfully , But nothing be printed.  I run the client.class and server.class on linux where hava setup zeromq and jzmq, this time, out put "abcc". I want to get the reasons why there is nothing be printed on windows7. Can you give me a solution for the problem.
 
thank you very much!
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131017/6d15bbfa/attachment.htm>


More information about the zeromq-dev mailing list