/**
+ * Return the address on which we listen to for shutdown commands.
+ */
+ public String getAddress();
+
+
+ /**
+ * Set the address on which we listen to for shutdown commands.
+ *
+ * @param address The new address
+ */
+ public void setAddress(String address);
+
+
+ /**
* Return the shutdown command string we are waiting for.
*/
public String getShutdown();
*/
private int port = 8005;
+ /**
+ * The address on which we wait for shutdown commands.
+ */
+ private String address = "127.0.0.1";
+
/**
* A random number generator that is <strong>only</strong> used if
/**
+ * Return the address on which we listen to for shutdown commands.
+ */
+ public String getAddress() {
+
+ return (this.address);
+
+ }
+
+
+ /**
+ * Set the address on which we listen to for shutdown commands.
+ *
+ * @param address The new address
+ */
+ public void setAddress(String address) {
+
+ this.address = address;
+
+ }
+
+ /**
* Return the shutdown command string we are waiting for.
*/
public String getShutdown() {
try {
serverSocket =
new ServerSocket(port, 1,
- InetAddress.getByName("127.0.0.1"));
+ InetAddress.getByName(address));
} catch (IOException e) {
log.error("StandardServer.await: create[" + port
+ + ":" + address
+ "]: ", e);
System.exit(1);
}
// Stop the existing server
try {
- Socket socket = new Socket("127.0.0.1", server.getPort());
+ Socket socket = new Socket(server.getAddress(), server.getPort());
OutputStream stream = socket.getOutputStream();
String shutdown = server.getShutdown();
for (int i = 0; i < shutdown.length(); i++)