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
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user