You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a scenario of REQ/ REP where the replier keeps polling for any requests coming from the requester using the standard poller apis.
we have a ruby implementation of the above scenario.
The issue we are facing is that the above scenario works only with the ipc protocol and not with the tcp protocol(in the bind and connect urls of replier and requester respectively).
However if we go by the standard requester / replier with the send/receive function then the whole process works well with the tcp and ipc protocol both.
The issue happens on changing the the replier code to the poller implementation and the requester/replier are not able to communicate with each other.
We also tried out the corresponding C++ implementation and it seems to work fine for both tcp/ipc protocols and both standard/poller implementations I want to know if there is any important part missing in the code or some OS setting that needs to be changed to get the ruby code working with the poller implementation?
require 'rubygems'
require 'ffi-rzmq'
puts "Starting Server..."
context = ZMQ::Context.new
socket = context.socket(ZMQ::REP)
socket.bind("tcp://localhost:5555") //This does not works...But changing it to socket.bind("ipc:///tmp/feed") and making the same change in the requester connect url makes it work
poller = ZMQ::Poller.new
poller.register(socket, ZMQ::POLLIN)
loop do
puts 'Before poll'
poller.poll(1000)
request = ''
puts 'After poll'
poller.readables.each do |sock|
puts 'here'
if sock === socket
sock.recv_string(request)
puts "Received request. Data: #{request.inspect}"
sock.send_string('Reply from the server')
end
end
end
I have a scenario of REQ/ REP where the replier keeps polling for any requests coming from the requester using the standard poller apis.
we have a ruby implementation of the above scenario.
The issue we are facing is that the above scenario works only with the
ipc
protocol and not with thetcp
protocol(in the bind and connect urls of replier and requester respectively).However if we go by the standard requester / replier with the send/receive function then the whole process works well with the
tcp
andipc
protocol both.The issue happens on changing the the replier code to the poller implementation and the requester/replier are not able to communicate with each other.
We also tried out the corresponding C++ implementation and it seems to work fine for both
tcp
/ipc
protocols and both standard/poller implementationsI want to know if there is any important part missing in the code or some OS setting that needs to be changed to get the ruby code working with the poller implementation?
RUBY implementation
REQUESTER
REPLIER with standard receive/send implementation
REPLIER with poller implementation
Version info:-
ruby : 1.8.7
rubygems : 1.8.25
ffi : 1.0.10
ffi-rzmq : 0.9.7
OS : rhel 7.2
g++ : 4.8.5
zmq : 3.2.5-1.el7
The text was updated successfully, but these errors were encountered: