diff options
author | pks <pks@users.noreply.github.com> | 2019-05-12 20:10:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-12 20:10:37 +0200 |
commit | 4a13b41700f34c15c30b551f98dbea9cb41f67c3 (patch) | |
tree | 0218f41c350a626f5af9909d77406309fa873fdf /feed.rb | |
parent | e9268eb3dcd867f3baf67a7bb3d2aad56196ecde (diff) | |
parent | f64746ac87fc7338629b19de9fa2da0f03fa2790 (diff) |
Merge branch 'net' into origin/net
Diffstat (limited to 'feed.rb')
-rwxr-xr-x | feed.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/feed.rb b/feed.rb new file mode 100755 index 00000000..a925d31c --- /dev/null +++ b/feed.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require 'nanomsg' +require 'trollop' + +conf = Trollop::options do + opt :addr, "URL of socket", :type => :string, :short => '-a', :default => "tcp://127.0.0.1:31337" +end + +sock = NanoMsg::PairSocket.new +addr = conf[:addr] +sock.connect addr +puts "< got #{sock.recv}" + +while true + line = STDIN.gets + if !line || line.strip=='shutdown' + puts "shutting down" + sock.send 'shutdown' + break + end + puts "sending '#{line.strip}'" + sock.send line.strip + sleep 1 + puts "got response '#{sock.recv}'" +end + |