Skip to content

Instantly share code, notes, and snippets.

@erikh
Created January 21, 2012 08:46
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 erikh/4fce21451fee6af600fe to your computer and use it in GitHub Desktop.
Save erikh/4fce21451fee6af600fe to your computer and use it in GitHub Desktop.
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
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