Created
December 14, 2015 15:12
-
-
Save hintjens/de2859f58ba42d190433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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