Sha256: bf5c51399c4fbc5e0d3ba2c4664dc1da25826cd2db57ab58d5c27ee0759dfb8d
Contents?: true
Size: 536 Bytes
Versions: 10
Compression:
Stored size: 536 Bytes
Contents
#!/usr/bin/env ruby require 'rubygems' require 'socket' require 'biodiversity' # Get sockets from stdlib puts "Running parser service on port 4334" parser = ScientificNameParser.new server = TCPServer.open(4334) # Socket to listen on port 4334 loop do # Servers run forever client = server.accept # Wait for a client to connect while a = client.readline if ['end','exit','q', '.'].include? a.strip client.close break end client.puts parser.parse(a).to_json end end
Version data entries
10 entries across 10 versions & 2 rubygems