X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2Fserver%2FServer.java;h=04701590e1c669c7d2dd143e7c9d3e921052b5b5;hb=505be508ae7d3fb48122be548b310a238cfb91eb;hp=932a705136d5a550df5dc5a7d8992b5e313c37fe;hpb=a0eb51f41b98280d751d13d15489a6e375fe8b80;p=fanfix.git diff --git a/src/be/nikiroo/utils/serial/server/Server.java b/src/be/nikiroo/utils/serial/server/Server.java index 932a705..0470159 100644 --- a/src/be/nikiroo/utils/serial/server/Server.java +++ b/src/be/nikiroo/utils/serial/server/Server.java @@ -324,8 +324,7 @@ abstract class Server implements Runnable { exiting = true; try { - new ConnectActionClientObject(new Socket((String) null, - port), key).connect(); + getConnectionToMe().connect(); long time = 0; while (ss != null && timeout > 0 && timeout > time) { Thread.sleep(10); @@ -349,6 +348,20 @@ abstract class Server implements Runnable { } } + /** + * Return a connection to this server (used by the Exit code to send an exit + * message). + * + * @return the connection + * + * @throws UnknownHostException + * the host should always be NULL (localhost) + * @throws IOException + * in case of I/O error + */ + abstract protected ConnectActionClient getConnectionToMe() + throws UnknownHostException, IOException; + /** * Change the number of currently serviced actions. * @@ -403,48 +416,4 @@ abstract class Server implements Runnable { @SuppressWarnings("unused") protected void onRequestDone(long id, long bytesReceived, long bytesSent) { } - - /** - * Create a {@link Socket}. - * - * @param host - * the host to connect to - * @param port - * the port to connect to - * - * @return the {@link Socket} - * - * @throws IOException - * in case of I/O error - * @throws UnknownHostException - * if the host is not known - * @throws IllegalArgumentException - * if the port parameter is outside the specified range of valid - * port values, which is between 0 and 65535, inclusive - */ - @Deprecated - static Socket createSocket(String host, int port) throws IOException { - return new Socket(host, port); - } - - /** - * Create a {@link ServerSocket}. - * - * @param port - * the port to accept connections on - * - * @return the {@link ServerSocket} - * - * @throws IOException - * in case of I/O error - * @throws UnknownHostException - * if the IP address of the host could not be determined - * @throws IllegalArgumentException - * if the port parameter is outside the specified range of valid - * port values, which is between 0 and 65535, inclusive - */ - @Deprecated - static ServerSocket createSocketServer(int port) throws IOException { - return new ServerSocket(port); - } }