Sha256: 981f87d4f385130b103c25c9435ee6944d56e3da8d598bfdc8e54a8baae443f8

Contents?: true

Size: 420 Bytes

Versions: 8

Compression:

Stored size: 420 Bytes

Contents

require 'rubygems'
require 'ffi-rzmq'


link = "tcp://127.0.0.1:5555"

ctx = ZMQ::Context.new 1
s1 = ctx.socket ZMQ::REQ
s2 = ctx.socket ZMQ::REP

s2.bind link
s1.connect link

payload = "#{ '3' * 2048 }"
sent_msg = ZMQ::Message.new payload
received_msg = ZMQ::Message.new

s1.send sent_msg
s2.recv received_msg

result = payload == received_msg.copy_out_string ? "Request received" : "Received wrong payload"

p result

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ffi-rzmq-0.8.2 examples/request_response.rb
ffi-rzmq-0.8.0 examples/request_response.rb
ffi-rzmq-0.7.2 examples/request_response.rb
ffi-rzmq-0.7.1 examples/request_response.rb
ffi-rzmq-0.7.0 examples/request_response.rb
ffi-rzmq-0.6.0 examples/request_response.rb
ffi-rzmq-0.5.1 examples/request_response.rb
ffi-rzmq-0.5.0 examples/request_response.rb