Sha256: 047f44faa0a1648a1ce19818d8c11ed8ee7a98e54bc288d0c14169d0fc1162da

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

# encoding: utf-8

# request.rb

# This example is used in conjunction with reply.rb. Run this program in
# a terminal/console window and then run reply.rb in another terminal/console
# window and observe the output.
#
# Usage: ruby request.rb
#

require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rxs')

ctx = XS::Context.create()
socket = ctx.socket(XS::REQ)
socket.connect("tcp://127.0.0.1:5000")
 
(1..10).each do |i|
  msg = "msg #{i.to_s}"
  socket.send_string(msg)
  puts "Sending: " + msg
  socket.recv_string(msg_in = '')
  puts "Received: " + msg_in
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-rxs-1.2.1 examples/request.rb
ffi-rxs-1.2.0 examples/request.rb