Ok after yesterday’s fun, I’m going to install jzmq now. Actually the instructions on that page is all you need with a couple of minor changes.
java -Djava.library.path=/usr/local/lib -classpath /home/user/zeromq/libjzmq local_lat tcp://127.0.0.1:5555 1 100is wrong and confusing.
The correct command needs the jar and library that was installed in the
make install step.
For me the library files was indeed installed to
/usr/local/lib (again I’m on ubuntu) but you can verify by the output of
Also the output of
make install will show you where zmq.jar was installed to. For me it was under
Finally, this uses local_lat which is actually in the ./perf directory of the jzmq source.
So actually the command should be:
java -Djava.library.path=/usr/local/lib -classpath /usr/local/share/java/zmq.jar:. local_lat tcp://127.0.0.1:5555 1 100
If you run from the perf directory where the class resides.
It doesn’t have any output as it’s just repeating whatever it received.
So when you start it up so just load up the client python script again and you should see:
python >>> import client >>> client.echo("hello") Client sending hello Client received hello
Obviously change the url in client.py or the command line used to match.
This is kind of annoying for redistributable projects though. There has to be a better way. Well clone or update my zmq_stuff repo again. In jzmq-sample you will see a gradle project that uses a maven repo library for jzmq and pulls the native libs for my current ubuntu platform as well.
This won’t always work for you because you need to have the native libraries for the platform you intend to run on. So, worst case, you still have to build and bundle the above as a maven library to use it this way.
And you still have to make sure that zmq is installed on whatever machine that you run on.
Either way just run gradle run in the jzmq-sample project and it will start up a subscribe on epgm (multicast). I don’t know how to get the gradle application plugin to accept command line arguments (except a rather hacky groovy properties way) so you will just have to look at and edit the source to try other socket types and other protocols. But it should be simple enough to understand. :)