summaryrefslogtreecommitdiff
path: root/training/dtrain/feed.rb
blob: 5f45edfbe786943d985e2dd83a598a9c23fc220c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby

require 'nanomsg'

#port = ARGV[0]
port = 60666
sock = NanoMsg::PairSocket.new
addr = "tcp://127.0.0.1:#{port}"
#addr = "ipc:///tmp/network_decoder.ipc"
sock.connect 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