package org.robockets.runqueue.server;

import java.util.LinkedList;
import java.util.Queue;

public class Server {
	public static Queue<User> userQueue = new LinkedList<User>();
	public static void main(String args[]) {
		//TODO: main method
	}
}

@@ -33,16 +33,141 @@
 erver;%0A%0A
+import java.io.IOException;%0Aimport java.net.InetAddress;%0Aimport java.net.ServerSocket;%0Aimport java.net.UnknownHostException;%0A
 import j
@@ -187,16 +187,16 @@
 edList;%0A
-
 import j
@@ -347,25 +347,1453 @@
 %09%09//
-TODO: main method
+ CLI argument handling.%0A%09%09ServerSocket serverSocket;%0A%09%09// Defaults%0A%09%09int port = 211; // Texas instruments occupies port 211, but who cares?%0A%09%09int backlog = 0;%0A%09%09InetAddress bindAddr = null;%0A%09%09%0A%09%09switch(args.length)%7B%0A%09%09/*%0A%09%09 * NOTE: No case 0: because that is default.%0A%09%09 * NOTE: Descending order without breaks because of the logic that the ones below it should be executed.%0A%09%09 */%0A%09%09%09case 3: %0A%09%09%09%09try %7B%0A%09%09%09%09%09InetAddress.getByName(args%5B2%5D);%0A%09%09%09%09%7D catch (UnknownHostException e) %7B%0A%09%09%09%09%09System.err.println(args%5B2%5D+%22 is not an Internet Address!%22);%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%09System.exit(0);%0A%09%09%09%09%7D%0A%09%09%09case 2:%0A%09%09%09%09try %7B%0A%09%09%09%09%09backlog = Integer.parseInt(args%5B1%5D);%0A%09%09%09%09%7D catch (NumberFormatException ne)%7B%0A%09%09%09%09%09System.err.println(args%5B1%5D+%22 is not something that can be cast into a number for the backlog argument.%22);%0A%09%09%09%09%09ne.printStackTrace();%0A%09%09%09%09%09System.exit(0);%0A%09%09%09%09%7D%0A%09%09%09case 1:%0A%09%09%09%09try %7B%0A%09%09%09%09%09port = Integer.parseInt(args%5B0%5D); // TODO: Port needs more checking (no negative numbers and more).%0A%09%09%09%09%7D catch (NumberFormatException ne)%7B%0A%09%09%09%09%09System.err.println(args%5B0%5D+%22 is not something that can be cast into an int for the port.%22);%0A%09%09%09%09%09System.exit(0);%0A%09%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09try %7B%0A%09%09%09if(bindAddr != null)%7B%0A%09%09%09%09// NOTE: Not dead code, eclipse is wrong.%0A%09%09%09%09serverSocket = new ServerSocket(port, backlog, bindAddr);%0A%09%09%09%7D else %7B%0A%09%09%09%09serverSocket = new ServerSocket(port, backlog);%0A%09%09%09%7D%0A%09%09%7D catch (IOException e)%7B%0A%09%09%09e.printStackTrace();%0A%09%09%09System.exit(0);%0A%09%09%7D
 %0A%09%7D%0A

Add commandline support for creating a ServerSocket instance.