server: re-introduce the client/server versions
[fanfix.git] / src / be / nikiroo / utils / serial / server / ServerString.java
index 6fe4ad0df1a6aeb4d37aaba4de6a5f5bdf1ce306..b321cedf1cceb936f4afab4099905084ae4652ed 100644 (file)
@@ -4,6 +4,8 @@ import java.io.IOException;
 import java.net.Socket;
 import java.net.UnknownHostException;
 
+import be.nikiroo.utils.Version;
+
 /**
  * This class implements a simple server that can listen for connections and
  * send/receive Strings.
@@ -66,7 +68,7 @@ abstract public class ServerString extends Server {
        protected ConnectActionServer createConnectActionServer(Socket s) {
                return new ConnectActionServerString(s, key) {
                        @Override
-                       public void action() throws Exception {
+                       public void action(Version clientVersion) throws Exception {
                                long id = getNextId();
                                for (String data = rec(); data != null; data = rec()) {
                                        String rep = null;
@@ -95,6 +97,13 @@ abstract public class ServerString extends Server {
                };
        }
 
+       @Override
+       protected ConnectActionClient getConnectionToMe()
+                       throws UnknownHostException, IOException {
+               return new ConnectActionClientString(new Socket((String) null,
+                               getPort()), key);
+       }
+
        /**
         * This is the method that is called on each client request.
         * <p>