From cbca08878dd958dd7b74233ce08049b12fe36453 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 15 Jul 2002 03:09:29 +0000 Subject: [PATCH] Allow the port to be set from the command line (this should probably instead be hijacked from the actual server setting but this works for now). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1577 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../micasa/simulator/client/SimpleClient.java | 5 +---- .../micasa/simulator/client/SimulatorApp.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/micasa/simulator/client/SimpleClient.java b/src/java/com/threerings/micasa/simulator/client/SimpleClient.java index d5c0ccfae..3299173bf 100644 --- a/src/java/com/threerings/micasa/simulator/client/SimpleClient.java +++ b/src/java/com/threerings/micasa/simulator/client/SimpleClient.java @@ -1,5 +1,5 @@ // -// $Id: SimpleClient.java,v 1.5 2002/07/12 03:49:37 mdb Exp $ +// $Id: SimpleClient.java,v 1.6 2002/07/15 03:09:29 mdb Exp $ package com.threerings.micasa.simulator.client; @@ -46,9 +46,6 @@ public class SimpleClient _occdir = new OccupantDirector(_ctx); _pardtr = new ParlorDirector(_ctx); - // for test purposes, hardcode the server info - _client.setServer("localhost", 4007); - // keep this for later _frame = frame; diff --git a/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java b/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java index 77a25cbfa..890052df6 100644 --- a/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java +++ b/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java @@ -1,5 +1,5 @@ // -// $Id: SimulatorApp.java,v 1.10 2002/07/12 03:50:24 mdb Exp $ +// $Id: SimulatorApp.java,v 1.11 2002/07/15 03:09:29 mdb Exp $ package com.threerings.micasa.simulator.client; @@ -96,12 +96,23 @@ public class SimulatorApp // start up the client Client client = _client.getParlorContext().getClient(); - // we're connecting to our own server - client.setServer("localhost", Client.DEFAULT_SERVER_PORT); + // obtain the port information from system properties + int port = Client.DEFAULT_SERVER_PORT; + String portstr = System.getProperty("port"); + if (portstr != null) { + try { + port = Integer.parseInt(portstr); + } catch (NumberFormatException nfe) { + Log.warning("Invalid port specification '" + portstr + "'."); + } + } + Log.info("Connecting to localhost:" + port + "."); + client.setServer("localhost", port); // we want to exit when we logged off or failed to log on client.addClientObserver(new ClientAdapter() { public void clientFailedToLogon (Client c, Exception cause) { + Log.info("Client failed to logon: " + cause); System.exit(0); } public void clientDidLogoff (Client c) {