Startup
This commit is contained in:
26
plugins/TestZMQ.java
Normal file
26
plugins/TestZMQ.java
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user