Request-reply client in Ruby

#!/usr/bin/env ruby

# author: Oleg Sidorov <4pcbr> moc.liamg|rbcp4i#moc.liamg|rbcp4i
# this code is licenced under the MIT/X11 licence.

require 'rubygems'
require 'ffi-rzmq'

context = ZMQ::Context.new
socket = context.socket(ZMQ::REQ)
socket.connect('tcp://localhost:5559')

10.times do |request|
string = "Hello #{request}"
socket.send_string(string)
puts "Sending string [#{string}]"
socket.recv_string(message = '')
puts "Received reply #{request}[#{message}]"
end