/******************************************************************************
 *
 *  CS 6421 - Simple Conversation
 *  Compilation:  javac ConvServer.java
 *  Execution:    java ConvServer port
 *
 *  % java ConvServer portnum
 ******************************************************************************/

import java.net.Socket;
import java.net.ServerSocket;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.UnknownHostException;
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class FunctionServer {
    static final boolean debug=true;

    public static void process (Socket clientSocket) throws IOException {
        // open up IO streams
        BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);

        /* Write a welcome message to the client */
        //out.println("Welcome, you are connected to a Java-based server");

        /* read and print the client's request */
        // readLine() blocks until the server receives a new line from client
        String userInput;
        if ((userInput = in.readLine()) == null) {
            System.out.println("Error reading message");
            out.close();
            in.close();
            clientSocket.close();
        }

        String tokens[] = userInput.split(" ");
        switch(tokens[0]){
          case "set":
            if(debug) System.out.println("Set function");
            break;
          case "get":
            if(debug) System.out.println("Get function");
            break;
          default:
            out.println("Message not recognized : " + tokens[0]);
        }

        // close IO streams, then socket
        out.close();
        in.close();
        clientSocket.close();
    }

    public static void main(String[] args) throws Exception {

        //check if argument length is invalid
        if(args.length != 1) {
            System.err.println("Usage: java ConvServer port");
        }
        // create socket
        int port = Integer.parseInt(args[0]);
        ServerSocket serverSocket = new ServerSocket(port);
        System.err.println("Started server on port " + port);

        // wait for connections, and process
        try {
            while(true) {
                // a "blocking" call which waits until a connection is requested
                Socket clientSocket = serverSocket.accept();
                System.err.println("\nAccepted connection from client");
                process(clientSocket);
            }

        }catch (IOException e) {
            System.err.println("Connection Error");
        }
        System.exit(0);
    }
}

@@ -553,45 +553,188 @@
 r %7B%0A
+%0A
     
-static final boolean debug=true;%0A
+private static String set(String input)%7B%0A      return %22set function called%22;%0A    %7D%0A%0A    private static String get(String input)%7B%0A      return %22get function called%22;%0A    %7D%0A    
 %0A   
@@ -1539,16 +1539,30 @@
 erInput.
+toLowerCase().
 split(%22 
@@ -1630,51 +1630,16 @@
     
-if(debug) System.out.println(%22Set function%22
+set(null
 );%0A 
@@ -1694,51 +1694,16 @@
     
-if(debug) System.out.println(%22Get function%22
+get(null
 );%0A 
@@ -1801,24 +1801,43 @@
 tokens%5B0%5D);%0A
+            break;%0A
         %7D%0A%0A 
@@ -2153,24 +2153,53 @@
 ver port%22);%0A
+            System.exit(-1);%0A
         %7D%0A  

Add set/get functions. Remove debug var