summaryrefslogtreecommitdiff
path: root/training/dtrain/feed1.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-05-08 21:43:45 +0200
committerPatrick Simianer <p@simianer.de>2015-05-08 21:43:45 +0200
commitd0b8fa29b83e6424e6d5848dbc42734b03896304 (patch)
treeb1f2529183e99b92b20f972d3c5e6739ad855adf /training/dtrain/feed1.rb
parentf678b442e8a0c2e685652d2b7006ccccce989c81 (diff)
parent64aac199c4a8821772dfaaaa9d162f4a3f5bf121 (diff)
Merge branch 'net' of github.com:pks/cdec-dtrain into net
Diffstat (limited to 'training/dtrain/feed1.rb')
-rwxr-xr-xtraining/dtrain/feed1.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/training/dtrain/feed1.rb b/training/dtrain/feed1.rb
new file mode 100755
index 00000000..a76e4c1e
--- /dev/null
+++ b/training/dtrain/feed1.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require 'nanomsg'
+
+#port = ARGV[0]
+port = 60667
+sock = NanoMsg::PairSocket.new
+addr = "tcp://127.0.0.1:#{port}"
+#addr = "ipc:///tmp/xxx.ipc"
+sock.bind addr
+
+#puts sock.recv
+while true
+ line = STDIN.gets
+ if !line
+ sock.send 'shutdown'
+ break
+ end
+ sock.send line.strip
+ sleep 1
+ puts "got translation: #{sock.recv}\n\n"
+ #sock.send "a=1 b=2"
+end
+