Skip to content

Instantly share code, notes, and snippets.

@ingeniarius
Forked from wjessop/recv.rb
Created July 12, 2011 18:55
Show Gist options
  • Save ingeniarius/1078689 to your computer and use it in GitHub Desktop.
Save ingeniarius/1078689 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'zmq'
z = ZMQ::Context.new
s = z.socket(ZMQ::UPSTREAM)
s.connect "tcp://127.0.0.1:5555"
while true
puts s.recv
end
require 'rubygems'
require 'zmq'
z = ZMQ::Context.new
s = z.socket(ZMQ::DOWNSTREAM)
s.bind("tcp://127.0.0.1:5555")
ARGV[0].to_i.times do |c|
s.send(c.to_s)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment