summaryrefslogtreecommitdiff
path: root/training/dtrain/feed.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-03-06 18:25:04 +0100
committerPatrick Simianer <p@simianer.de>2015-03-06 18:25:04 +0100
commit4ce8dd5d091d63fcafddb447475ae36f769fd8c5 (patch)
treed2b2ef717f307996dc64cb7affa625649cbf9774 /training/dtrain/feed.rb
parent4dba9e534e95561ad03815f182746d1714cd186b (diff)
first implementation of dtrain_net and downpour
Diffstat (limited to 'training/dtrain/feed.rb')
-rwxr-xr-xtraining/dtrain/feed.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/training/dtrain/feed.rb b/training/dtrain/feed.rb
new file mode 100755
index 00000000..fe8dd509
--- /dev/null
+++ b/training/dtrain/feed.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+
+require 'nanomsg'
+
+port = ARGV[0]
+sock = NanoMsg::PairSocket.new
+addr = "tcp://127.0.0.1:#{port}"
+sock.bind addr
+
+puts sock.recv
+while true
+ line = STDIN.gets
+ if !line
+ sock.send 'shutdown'
+ break
+ end
+ sock.send line.strip
+ sleep 1
+ sock.recv
+ sock.send "a=1 b=2"
+end
+