Created
October 1, 2010 18:34
-
-
Save bosoxbill/606643 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: Bill Desmarais [email protected] | |
# this code is licenced under the MIT/X11 licence. | |
require 'rubygems' | |
require 'zmq' | |
context = ZMQ::Context.new(1) | |
puts "Starting Hello World server..." | |
# socket to listen for clients | |
socket = context.socket(ZMQ::REP) | |
socket.bind("tcp://*:5555") | |
while true do | |
# Wait for next request from client | |
request = socket.recv | |
puts "Recieved request. Data: #{request.inspect}" | |
# Do some 'work' | |
sleep 1 | |
# Send reply back to client | |
socket.send("world") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment