@@ -0,0 +1,2743 @@
+/******************************************************************************%0A *%0A *  CS 6421 - Simple Conversation%0A *  Compilation:  javac ConvServer.java%0A *  Execution:    java ConvServer port%0A *%0A *  %25 java ConvServer portnum%0A ******************************************************************************/%0A%0Aimport java.net.Socket;%0Aimport java.net.ServerSocket;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport java.net.UnknownHostException;%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0A%0A%0Apublic class FunctionServer %7B%0A    static final boolean debug=true;%0A%0A    public static void process (Socket clientSocket) throws IOException %7B%0A        // open up IO streams%0A        BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));%0A        PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);%0A%0A        /* Write a welcome message to the client */%0A        //out.println(%22Welcome, you are connected to a Java-based server%22);%0A%0A        /* read and print the client's request */%0A        // readLine() blocks until the server receives a new line from client%0A        String userInput;%0A        if ((userInput = in.readLine()) == null) %7B%0A            System.out.println(%22Error reading message%22);%0A            out.close();%0A            in.close();%0A            clientSocket.close();%0A        %7D%0A%0A        String tokens%5B%5D = userInput.split(%22 %22);%0A        switch(tokens%5B0%5D)%7B%0A          case %22set%22:%0A            if(debug) System.out.println(%22Set function%22);%0A            break;%0A          case %22get%22:%0A            if(debug) System.out.println(%22Get function%22);%0A            break;%0A          default:%0A            out.println(%22Message not recognized : %22 + tokens%5B0%5D);%0A        %7D%0A%0A        // close IO streams, then socket%0A        out.close();%0A        in.close();%0A        clientSocket.close();%0A    %7D%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A%0A        //check if argument length is invalid%0A        if(args.length != 1) %7B%0A            System.err.println(%22Usage: java ConvServer port%22);%0A        %7D%0A        // create socket%0A        int port = Integer.parseInt(args%5B0%5D);%0A        ServerSocket serverSocket = new ServerSocket(port);%0A        System.err.println(%22Started server on port %22 + port);%0A%0A        // wait for connections, and process%0A        try %7B%0A            while(true) %7B%0A                // a %22blocking%22 call which waits until a connection is requested%0A                Socket clientSocket = serverSocket.accept();%0A                System.err.println(%22%5CnAccepted connection from client%22);%0A                process(clientSocket);%0A            %7D%0A%0A        %7Dcatch (IOException e) %7B%0A            System.err.println(%22Connection Error%22);%0A        %7D%0A        System.exit(0);%0A    %7D%0A%7D%0A

Implement basic function call server