27 lines
907 B
Java
27 lines
907 B
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
/**
|
|
*
|
|
* @author gac-S_Changer
|
|
*/
|
|
public class TestZMQ {
|
|
public static void main(String[] args) {
|
|
String server = "raspberrypi:5556";
|
|
org.zeromq.ZMQ.Context context = org.zeromq.ZMQ.context(1);
|
|
org.zeromq.ZMQ.Socket subscriber = context.socket(org.zeromq.ZMQ.SUB);
|
|
subscriber.connect("tcp://" + server);
|
|
subscriber.subscribe("Status".getBytes());
|
|
while (!Thread.currentThread().isInterrupted()) {
|
|
String type = subscriber.recvStr();
|
|
String contents = subscriber.recvStr();
|
|
System.out.println(type + " : " + contents);
|
|
}
|
|
subscriber.close();
|
|
context.term();
|
|
}
|
|
}
|