This commit is contained in:
gac-S_Changer
2017-02-10 10:40:27 +01:00
parent 0c2aa4dc56
commit ee82c62d4f

26
plugins/TestZMQ.java Normal file
View File

@@ -0,0 +1,26 @@
/*
* 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();
}
}