Last active
January 28, 2016 12:24
-
-
Save meetme2meat/1963a8e23f5db59af091 to your computer and use it in GitHub Desktop.
This is 2nd Client for Celluloid example
This file contains 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
require 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize | |
@socket = Socket::Push.new | |
begin | |
@socket.connect('tcp://192.168.1.10:3435') | |
rescue IOError | |
@socket.close | |
raise | |
end | |
end | |
def write(message) | |
@socket.send(message) | |
nil | |
end | |
end | |
client = Client.new() | |
## pass client-2 so that server does not go in sleep mode. | |
client.write('client-2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment