Sha256: e35a352e749a79a6ab3bd504cd15e603d703ba760630e2a8b4399454448d5d9e
Contents?: true
Size: 510 Bytes
Versions: 7
Compression:
Stored size: 510 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 client.close if ['end','exit','q', '.'].include? a.strip client.puts parser.parse(a).to_json end end
Version data entries
7 entries across 7 versions & 2 rubygems