Commit fce42683 authored by yannick legoc's avatar yannick legoc

Added option serverPort for remote clients which do not have a known hostname

parent 0d889c15
......@@ -27,6 +27,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
......@@ -564,6 +566,7 @@ public class ConfigManager {
public String getServerEndpoint() {
// The server endpoint can be entirely defined in the variable 'serverEndpoint'.
String serverEndpoint = getStringOrNothingAtAll("serverEndpoint");
if (serverEndpoint != null) {
......@@ -571,6 +574,24 @@ public class ConfigManager {
return serverEndpoint;
}
// The server endpoint can be partially defined in the variable 'serverPort'.
// In that case, the own IP address is used.
// It is necessary in case of a remote client because this endpoint is passed to the server responder to contact the client for its response.
// In future implementation of requester/responder this may not be necessary.
String serverPort = getStringOrNothingAtAll("serverPort");
// Default value for port.
if (serverPort == null) {
serverPort = "7000";
}
try {
serverEndpoint = "tcp://" + InetAddress.getLocalHost().getHostAddress() + ":" + serverPort;
System.out.println("================> serverEndPoint " + serverEndpoint);
return serverEndpoint;
} catch (UnknownHostException e) {
}
return "tcp://localhost:7000";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment