package edu.miamioh.cse283.htw;

import java.io.*;

public class CaveServer {
	// networking code
	//
	// send cave description to client
	// client sends actions to server
	// (play the game)
	public final static int PORT = 4484;

	public static void main(String[] args) {
		CaveServer c = new CaveServer();
		c.run();
	}

	public void run() {
	}
}

@@ -46,16 +46,36 @@
 a.io.*;%0D
+%0Aimport java.net.*;%0D
 %0A%0D%0Apubli
@@ -222,86 +222,181 @@
 %0D%0A%09p
-ublic final static int PORT = 4484;%0D%0A%0D%0A%09public static void main(String%5B%5D args)
+rotected ServerSocket clientSocket;%0D%0A%09protected ServerSocket caveSystemServerSocket;%0D%0A%0D%0A%09public static void main(String%5B%5D args) throws NumberFormatException,%0D%0A%09%09%09IOException
  %7B%0D%0A
@@ -427,16 +427,41 @@
 eServer(
+Integer.parseInt(args%5B0%5D)
 );%0D%0A%09%09c.
@@ -486,24 +486,831 @@
 lic 
-void run() %7B%0D%0A%09%7D
+CaveServer(int basePort) throws IOException %7B%0D%0A%09%09clientSocket = new ServerSocket(basePort);%0D%0A%09%09caveSystemServerSocket = new ServerSocket(basePort + 1);%0D%0A%09%7D%0D%0A%0D%0A%09public void run() throws IOException %7B%0D%0A%09%09while (true) %7B%0D%0A%09%09%09Socket client = clientSocket.accept();%0D%0A%09%09%09(new Thread(new ServerThread(client))).start();%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%09public class ServerThread implements Runnable %7B%0D%0A%09%09protected Socket client;%0D%0A%0D%0A%09%09public ServerThread(Socket client) %7B%0D%0A%09%09%09this.client = client;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09public void run() %7B%0D%0A%09%09%09try %7B%0D%0A%09%09%09%09BufferedReader in = new BufferedReader(new InputStreamReader(%0D%0A%09%09%09%09%09%09client.getInputStream()));%0D%0A%09%09%09%09PrintWriter out = new PrintWriter(client.getOutputStream(),%0D%0A%09%09%09%09%09%09true);%0D%0A%0D%0A%09%09%09%09out.println(%22localhost%22);%0D%0A%09%09%09%09out.println(%22%22 + 1235);%0D%0A%09%09%09%7D catch (IOException e) %7B%0D%0A%09%09%09%09e.printStackTrace();%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A
 %0D%0A%7D%0D

copy paste CaveSystemServer to CaveServer