You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/zeromq/hwclient.rb

25 lines
439 B

# vim:fileencoding=utf-8
require 'zmq'
def main
context = ZMQ::Context.new(1)
puts "Connecting to hello world server…"
requester = context.socket(ZMQ::REQ)
requester.connect("tcp://localhost:5555")
0.upto(9) do |request_nbr|
puts "Sending request #{request_nbr}"
requester.send("Hello")
reply = requester.recv(6)
puts "Received reply #{request_nbr}: [#{reply}]"
end
end
if $0 == __FILE__
main
end