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

require 'nanomsg'

port = 60666
sock = NanoMsg::PairSocket.new
addr = "tcp://127.0.0.1:#{port}"
#addr = "ipc:///tmp/network_decoder.ipc"
sock.connect addr

while true
  line = STDIN.gets
  if !line
    sock.send 'shutdown'
    break
  end
  puts "sending source '#{line.strip}'"
  sock.send line.strip
  sleep 1
  puts "got translation: #{sock.recv}\n\n"
end