diff --git a/protocol.txt b/protocol.txt index 25313e8..bb57580 100644 --- a/protocol.txt +++ b/protocol.txt @@ -13,6 +13,7 @@ Parameters as GET: * cpu_cores: Number of core (or thread) available. * ram: Memory available in bytes. * extras (optional): Extra data use for the configuration. + * hostname (optional): Hostname of the machine, it's useful when the user have multiple machines with same hardware configuration. It's only used for display for server website. Answer in case of error: diff --git a/src/com/sheepit/client/Server.java b/src/com/sheepit/client/Server.java index 33a1dbe..0c20868 100644 --- a/src/com/sheepit/client/Server.java +++ b/src/com/sheepit/client/Server.java @@ -33,6 +33,7 @@ import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.ConnectException; import java.net.HttpURLConnection; +import java.net.InetAddress; import java.net.MalformedURLException; import java.net.NoRouteToHostException; import java.net.URL; @@ -163,7 +164,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager OS os = OS.getOS(); HttpURLConnection connection = null; try { - String url_contents = String.format("%s%s?login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&extras=%s", + String url_contents = String.format("%s%s?login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&hostname=%s&extras=%s", this.base_url, "/server/config.php", URLEncoder.encode(this.user_config.login(), "UTF-8"), @@ -176,6 +177,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager os.getMemory(), os.getCPU().arch(), this.user_config.getJarVersion(), + URLEncoder.encode(InetAddress.getLocalHost().getHostName(), "UTF-8"), this.user_config.getExtras()); this.log.debug("Server::getConfiguration url " + url_contents);