From 6b9424128d1be11a4be82b83226321d27996e665 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 16 Jul 2002 05:44:29 +0000 Subject: [PATCH] Read both the server and port from system properties. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1579 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/micasa/client/MiCasaApp.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/micasa/client/MiCasaApp.java b/src/java/com/threerings/micasa/client/MiCasaApp.java index 6bb655602..970143e63 100644 --- a/src/java/com/threerings/micasa/client/MiCasaApp.java +++ b/src/java/com/threerings/micasa/client/MiCasaApp.java @@ -1,5 +1,5 @@ // -// $Id: MiCasaApp.java,v 1.8 2002/07/12 17:01:28 mdb Exp $ +// $Id: MiCasaApp.java,v 1.9 2002/07/16 05:44:29 mdb Exp $ package com.threerings.micasa.client; @@ -52,11 +52,23 @@ public class MiCasaApp Client client = _client.getContext().getClient(); + // read our server and port settings String server = System.getProperty("server"); - if (server != null) { - // indicate which server to which we should connect - client.setServer(server, Client.DEFAULT_SERVER_PORT); + if (server == null) { + server = "localhost"; } + 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 + "'."); + } + } + + // pass them on to the client + client.setServer(server, port); // configure the client with some credentials and logon String username = System.getProperty("username");