From 73dee778c58e30bdd5796257ceb05960fa287187 Mon Sep 17 00:00:00 2001 From: Benjamin Attal Date: Sun, 1 Jun 2014 01:29:01 -0400 Subject: [PATCH] Can specify which port to run ruby server on. --- parsers/java/src/main/java/com/bitshift/parsing/Parse.java | 1 + parsers/ruby/Rakefile | 4 ++-- parsers/ruby/lib/parse_server.rb | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/parsers/java/src/main/java/com/bitshift/parsing/Parse.java b/parsers/java/src/main/java/com/bitshift/parsing/Parse.java index ae54a9e..1964b59 100644 --- a/parsers/java/src/main/java/com/bitshift/parsing/Parse.java +++ b/parsers/java/src/main/java/com/bitshift/parsing/Parse.java @@ -6,6 +6,7 @@ public class Parse { public static void main(String[] args) { ParseServer server = new ParseServer(Integer.parseInt(args[0])); + System.out.println("Java Server listening on port " + args[0]); new Thread(server).start(); } diff --git a/parsers/ruby/Rakefile b/parsers/ruby/Rakefile index e66f695..f8cdf64 100644 --- a/parsers/ruby/Rakefile +++ b/parsers/ruby/Rakefile @@ -1,5 +1,5 @@ require File.expand_path('../lib/parse_server.rb', __FILE__) -task :start_server do |t| - start_server +task :start_server, [:port_number] do |t, args| + start_server Integer(args[:port_number]) end diff --git a/parsers/ruby/lib/parse_server.rb b/parsers/ruby/lib/parse_server.rb index 9a929aa..2c87e49 100644 --- a/parsers/ruby/lib/parse_server.rb +++ b/parsers/ruby/lib/parse_server.rb @@ -13,8 +13,9 @@ def pack_int(i) end -def start_server - server = TCPServer.new 5065 +def start_server(port_number) + server = TCPServer.new port_number + puts "Ruby Server listening on port #{port_number}\n" loop do # Start a new thread for each client accepted