-
-
Save erikh/4fce21451fee6af600fe to your computer and use it in GitHub Desktop.
This file contains 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
require 'zmq' | |
socket = ZMQ::Context.new.socket(ZMQ::REQ) | |
socket.connect("ipc://sm") | |
trap(:INT) { socket.close; exit } | |
socket.send(ARGV[0]) | |
puts socket.recv | |
socket.close |
This file contains 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
require 'zmq' | |
socket = ZMQ::Context.new.socket(ZMQ::REP) | |
socket.bind("ipc://sm") | |
trap(:INT) { socket.close; exit } | |
loop do | |
msg = socket.recv(ZMQ::NOBLOCK) | |
if msg | |
socket.send("well hello there!") | |
end | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment