-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sim.java
34 lines (25 loc) · 863 Bytes
/
Sim.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
import javax.json.Json;
import javax.json.JsonObject;
import java.io.StringWriter;
public class Sim {
public static void main(String[] argv) {
ZContext ctx = new ZContext();
Socket request = ctx.createSocket(ZMQ.REQ);
request.connect("tcp://127.0.0.1:9999");
JsonObject callArgs = Json
.createObjectBuilder()
.add("cmd", "simulate")
.add("args",
Json.createArrayBuilder().add("10000000"))
.build();
StringWriter s = new StringWriter();
Json.createWriter(s).write(callArgs);
request.send(s.toString());
String response = request.recvStr();
System.out.println(response);
ctx.close();
}
}