Created
March 14, 2014 05:01
-
-
Save amclain/9542364 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
require '0mq' | |
@server_keys = ZMQ::Curve.keypair | |
@client_keys = ZMQ::Curve.keypair | |
@path = 'tcp://127.0.0.1:5050' | |
# @path = 'ipc://test.ipc' | |
@server = ZMQ::Socket.new ZMQ::PULL | |
@server.set_opt ZMQ::CURVE_SERVER, 1 | |
@server.set_opt ZMQ::CURVE_SECRETKEY, @server_keys[:private] | |
@server.bind @path | |
@client = ZMQ::Socket.new ZMQ::PUSH | |
@client.set_opt ZMQ::CURVE_SERVERKEY, @server_keys[:public] | |
@client.set_opt ZMQ::CURVE_PUBLICKEY, @client_keys[:public] | |
@client.set_opt ZMQ::CURVE_SECRETKEY, @client_keys[:private] | |
@client.connect @path | |
@client.send_string 'test' | |
puts @server.recv_string | |
File.delete 'test.ipc' if File.exists? 'test.ipc' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment