Skip to content

Instantly share code, notes, and snippets.

@hintjens
Created December 14, 2015 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hintjens/de2859f58ba42d190433 to your computer and use it in GitHub Desktop.
Save hintjens/de2859f58ba42d190433 to your computer and use it in GitHub Desktop.
# CtrlcTest.java
import org.zeromq.czmq.Zmsg;
import org.zeromq.zyre.Zyre;
import static java.lang.System.*;
import java.util.Scanner;
public class CtrlcTest {
private static Zyre zyre = new Zyre("fred");
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
zyre.close ();
}
});
public static void main(String[] args) throws Exception {
zyre.start ();
Scanner scanner = new Scanner(in);
while (true) {
out.print("type \"exit\" to terminate: ");
String line = scanner.nextLine();
if (line.equals ("exit")) {
break;
}
}
zyre.close ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment