summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-05-13 18:07:40 +0200
committerPatrick Simianer <p@simianer.de>2015-05-13 18:07:40 +0200
commit36de27e6798f8c41b4bbbdca887cbcf000ed6490 (patch)
tree55fa3332d5c2a8dd1a6e50940dc071fede50dd23
parentaf1af342b5c3faf1d5e290c6b623b6287fa8c2b0 (diff)
feed.rb
-rwxr-xr-xfeed.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/feed.rb b/feed.rb
new file mode 100755
index 00000000..58e3f78b
--- /dev/null
+++ b/feed.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+require 'nanomsg'
+
+port = 8888
+sock = NanoMsg::PairSocket.new
+addr = "tcp://127.0.0.1:#{port}"
+sock.connect addr
+puts 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
+