Index: AndroidManifest.xml
===================================================================
--- AndroidManifest.xml	(revision 9d030cba71caae983d658b0d8f9eca82968ad2a3)
+++ AndroidManifest.xml	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -11,3 +11,4 @@
     </application>
     <uses-sdk android:minSdkVersion="7" />
+    <uses-permission android:name="android.permission.INTERNET" />
 </manifest>
Index: res/values/strings.xml
===================================================================
--- res/values/strings.xml	(revision 9d030cba71caae983d658b0d8f9eca82968ad2a3)
+++ res/values/strings.xml	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -8,7 +8,5 @@
     <string name="menu_pause">Pause</string>
     <string name="menu_resume">Resume</string>
-    <string name="menu_easy">Easy</string>
-    <string name="menu_medium">Medium</string>
-    <string name="menu_hard">Hard</string>
+    <string name="menu_connect">Connect</string>
     
     <string name="mode_ready">Lunar Lander\nPress Up To Play</string>
Index: src/com/example/helloandroid/ClientThread.java
===================================================================
--- src/com/example/helloandroid/ClientThread.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
+++ src/com/example/helloandroid/ClientThread.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -0,0 +1,45 @@
+package com.example.helloandroid;
+
+/*
+ * This thread is responsible for interacting with the server. It waits to receive messages from the server and then handles them.
+ */
+
+public class ClientThread extends Connection {
+	private Game main;
+	
+    public ClientThread(String ip, int port, Game main) {
+    	super(ip, port, "ClientThread");
+    	
+    	this.main = main;
+    }
+    
+    protected void processMessage(MessageType type, String input) {
+        
+    }
+    
+    protected void connectionStart() {
+    	main.mThread.connMessage = "Connection Started";
+    }
+    
+    protected void connectionSuccess() {
+    	main.mThread.connMessage = "Connected to Server";
+    	sendMessage(MessageType.Info, "Yo, youze beeze gay!");
+    }
+    
+    protected void connectionFailure(String str) {
+    	main.mThread.connMessage = "Server not found";
+    	main.mThread.connMessage = str;
+    }
+    
+    protected void connectionBreak() {
+    	main.mThread.connMessage = "Your connection was interrupted";
+    }
+    
+    protected void peerDisconnect() {
+    	main.mThread.connMessage = "The server disconnected";
+    }
+    
+    protected void connectionEnd() {
+    	
+    }
+}
Index: src/com/example/helloandroid/Connection.java
===================================================================
--- src/com/example/helloandroid/Connection.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
+++ src/com/example/helloandroid/Connection.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -0,0 +1,155 @@
+package com.example.helloandroid;
+import java.net.*;
+import java.io.*;
+
+
+/*
+ * This class serves as a basis for the threads that the other projects use to listen to incoming messages over a network. The most important
+ * method, run, initializes a connection based on the constructor arguments and calls different methods depending on the result, which could
+ * range from a successful connection, to an unsuccessful one, to one that gets interrupted later on. Any class inheriting this one simply
+ * has to extend the methods called in run and the processMessage method to customize the behavior in different situations.
+ */
+
+public class Connection extends Thread {
+	private boolean connected;
+	private boolean interrupted;
+	private String ip;
+	private int port;
+    private Socket socket;
+    private PrintWriter out;
+    private BufferedReader in;
+
+    public Connection(String ip, int port, String threadName) {
+    	super(threadName);
+    	
+    	connected = false;
+    	interrupted = false;
+    	socket = null;
+    	this.ip = ip;
+    	this.port = port;
+    }
+    
+    public Connection(Socket socket, String threadName) {
+    	super(threadName);
+    	
+    	connected = false;
+    	interrupted = false;
+    	this.socket = socket;
+    }
+    
+    public static boolean isConnected(Connection obj) {
+    	return obj != null && obj.connected;
+    }
+    
+    protected PrintWriter getOut() {
+    	return out;
+    }
+    
+    protected BufferedReader getIn() {
+    	return in;
+    }
+    
+    public void interrupt() {
+    	interrupted = true;
+    }
+    
+    public void closeConnection() {
+    	try {
+    		if(connected) {
+    			connected = false;
+	    		socket.close();
+		    	out.close();
+		    	in.close();
+    		}
+    	} catch(IOException ioe) {
+    		ioe.printStackTrace();
+    	}
+    }
+    
+    protected void sendMessage(MessageType type, String input) {
+		out.println(type);
+		out.println(input);
+    }
+    
+    protected void processMessage(MessageType type, String input) {
+    	
+    }
+    
+    protected void connectionStart() {
+    	
+    }
+    
+    protected void connectionSuccess() {
+    	
+    }
+    
+    protected void connectionFailure(String str) {
+    	
+    }
+    
+    protected void connectionBreak() {
+    	
+    }
+    
+    protected void peerDisconnect() {
+    	
+    }
+    
+    protected void connectionEnd() {
+    	
+    }
+    
+    public void run() {
+    	String strType, str;
+    	
+    	try {
+    		connectionStart();
+    		if(socket == null) {
+    			connectionFailure("about to make new socket");
+    			socket = new Socket(ip, port);
+    		}
+    		connectionFailure("made new socket");
+    		if(!interrupted) {
+    			out = new PrintWriter(socket.getOutputStream(), true);
+    			in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            	connected = true;
+            	connectionSuccess();
+    		}
+    		connectionFailure("end of connection");
+    	}catch(UnknownHostException uhe) {
+    		if(!interrupted)
+    			connectionFailure("UnknownHostException");
+    	}catch(ConnectException ce) {
+    		if(!interrupted)
+    			connectionFailure("ConnectException");
+    	}catch(IOException ioe) {
+    		if(!interrupted)
+    			ioe.printStackTrace();
+    		connectionFailure("IOException");
+    	}catch(Exception e) {
+    		connectionFailure("Exception");
+    	}catch(Throwable e) {
+    		connectionFailure("Throwable");
+    	}
+    	connectionFailure("finished connection");
+    	
+    	if(interrupted)
+    		closeConnection();
+    		
+    	try{
+    		while(connected && (strType = in.readLine()) != null && (str = in.readLine()) != null) {
+	    		processMessage(MessageType.valueOf(strType), str);
+	    	}
+    		if(connected)
+    			peerDisconnect();
+		}catch(SocketException se) {
+			if(connected)
+				connectionBreak();
+		}catch(IOException ioe) {
+			ioe.printStackTrace();
+		}
+
+		closeConnection();
+		connectionEnd();
+	}
+}
Index: src/com/example/helloandroid/Game.java
===================================================================
--- src/com/example/helloandroid/Game.java	(revision 9d030cba71caae983d658b0d8f9eca82968ad2a3)
+++ src/com/example/helloandroid/Game.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -11,24 +11,18 @@
 
 public class Game extends Activity {
-    private static final int MENU_EASY = 1;
-
-    private static final int MENU_HARD = 2;
-
-    private static final int MENU_MEDIUM = 3;
-
-    private static final int MENU_PAUSE = 4;
-
-    private static final int MENU_RESUME = 5;
-
-    private static final int MENU_START = 6;
-
-    private static final int MENU_STOP = 7;
+    private static final int MENU_PAUSE = 1;
+    private static final int MENU_RESUME = 2;
+    private static final int MENU_START = 3;
+    private static final int MENU_STOP = 4;
+    private static final int MENU_CONNECT = 5;
 
     /** A handle to the thread that's actually running the animation. */
-    private DrawingThread mThread;
+    public DrawingThread mThread;
 
     /** A handle to the View in which the game is running. */
     private GameView mGameView;
 
+    private ClientThread client;
+    
     /**
      * Invoked during init to give the Activity a chance to set up its Menu.
@@ -45,7 +39,5 @@
         menu.add(0, MENU_PAUSE, 0, R.string.menu_pause);
         menu.add(0, MENU_RESUME, 0, R.string.menu_resume);
-        menu.add(0, MENU_EASY, 0, R.string.menu_easy);
-        menu.add(0, MENU_MEDIUM, 0, R.string.menu_medium);
-        menu.add(0, MENU_HARD, 0, R.string.menu_hard);
+        menu.add(0, MENU_CONNECT, 0, R.string.menu_connect);
 
         return true;
@@ -66,6 +58,5 @@
                 return true;
             case MENU_STOP:
-            	mThread.setState(DrawingThread.STATE_LOSE,
-                        getText(R.string.message_stopped));
+            	mThread.setState(DrawingThread.STATE_LOSE, getText(R.string.message_stopped));
                 return true;
             case MENU_PAUSE:
@@ -75,4 +66,10 @@
             	mThread.unpause();
                 return true;
+            case MENU_CONNECT:
+            	mThread.connectionStarted = true;
+                client = new ClientThread("192.168.1.6", 1337, this);
+				client.start();
+				mThread.doStart();
+				return true;
         }
 
Index: src/com/example/helloandroid/GameView.java
===================================================================
--- src/com/example/helloandroid/GameView.java	(revision 9d030cba71caae983d658b0d8f9eca82968ad2a3)
+++ src/com/example/helloandroid/GameView.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -81,4 +81,7 @@
         
         int mFleetSize;
+        
+        public boolean connectionStarted;
+        public String connMessage;
 
         public DrawingThread(SurfaceHolder surfaceHolder, Context context,
@@ -107,4 +110,7 @@
             
             mFleetSize = 50;
+            
+            connectionStarted = false;
+            connMessage = "";
         }
 
@@ -346,5 +352,6 @@
             	}
         	}
-        	
+        
+        	//draw the fleet size bar on the bottom of the screen
         	float textSize = mTextPaint.getTextSize();
         	mTextPaint.setTextSize(24);
@@ -355,5 +362,5 @@
         	
         	mTextPaint.setTextSize(textSize);
-        	
+        
         	mLinePaint.setColor(Color.YELLOW);
         	canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, mCanvasWidth-70, mCanvasHeight-5), 5, 5, mLinePaint);
@@ -361,4 +368,9 @@
         	mLinePaint.setColor(Color.GREEN);
         	canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, 70+(mCanvasWidth-140)*mFleetSize/100, mCanvasHeight-5), 5, 5, mLinePaint);
+        	
+        	//draw connection info
+        	if(connectionStarted) {
+        		canvas.drawText(connMessage, (mCanvasWidth-mTextPaint.measureText(connMessage))/2, mCanvasHeight-200-(metrics.ascent+metrics.descent), mTextPaint);
+        	}
         }
 
Index: src/com/example/helloandroid/MessageType.java
===================================================================
--- src/com/example/helloandroid/MessageType.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
+++ src/com/example/helloandroid/MessageType.java	(revision 3a0d46809595cba3e6e5e24d2930e67a60a5d479)
@@ -0,0 +1,28 @@
+package com.example.helloandroid;
+
+
+public enum MessageType {
+	Admin,				//used
+	StartServer,		//used
+	StopServer,			//used
+	Info,				//used
+	Chat,				//used
+    Channel,			//used
+    Login,				//used
+    Create,				//used
+    LoadStart,			//used
+    LoadEnd,			//used
+    LoadMap,			//used
+    Registered,			//used
+    PlayerJoined,		//used
+    PlayerLeft,			//used
+    State,
+    Movement,			//used
+    Target,
+    Creature,
+    StatChange,
+    Item,
+    RegisteredItem,
+    Inventory,
+    Upgrade
+}
