Index: src/Connection.java
===================================================================
--- src/Connection.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
+++ src/Connection.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
@@ -0,0 +1,145 @@
+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;
+    private String name;
+    
+    
+    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) {
+    	System.out.println(input);
+    }
+    
+    protected void connectionStart() {
+    	
+    }
+    
+    protected void connectionSuccess() {
+    	
+    }
+    
+    protected void connectionFailure() {
+    	
+    }
+    
+    protected void connectionBreak() {
+    	
+    }
+    
+    protected void peerDisconnect() {
+    	
+    }
+    
+    protected void connectionEnd() {
+    	
+    }
+    
+    public void run() {
+    	String strType, str;
+    	
+    	try {
+    		connectionStart();
+    		if(socket == null)
+    			socket = new Socket(ip, port);
+    		if(!interrupted) {
+    			out = new PrintWriter(socket.getOutputStream(), true);
+    			in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            	connected = true;
+            	connectionSuccess();
+    		}
+    	}catch (UnknownHostException uhe) {
+    		if(!interrupted)
+    			connectionFailure();
+    	}catch (ConnectException ce) {
+    		if(!interrupted)
+    			connectionFailure();
+    	}catch(IOException ioe) {
+    		if(!interrupted)
+    			ioe.printStackTrace();
+    	}
+    	
+    	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/ConnectionListener.java
===================================================================
--- src/ConnectionListener.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
+++ src/ConnectionListener.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
@@ -0,0 +1,32 @@
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+
+public class ConnectionListener {
+	/*
+	 * This thread listens for connections from clients.
+	 */
+	public static boolean running = true;
+	private static ServerSocket socketServer;
+	private static GameServer gameServer;
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		gameServer = new GameServer();
+		try {
+			socketServer = new ServerSocket(1337);
+			while(running){
+				Socket clientSocket = null;
+				clientSocket = socketServer.accept();
+				System.out.println(clientSocket.getInetAddress()+ ":"+clientSocket.getPort());
+				gameServer.addConnection(clientSocket);
+			}
+		} catch (IOException e) {
+			System.out.println("Accept failed: 1337");
+			System.exit(-1);
+		}
+	}
+}
Index: c/GalconServer.java
===================================================================
--- src/GalconServer.java	(revision 6f3426aeee8462ec396d12fb17ea863f5aeb8f6b)
+++ 	(revision )
@@ -1,8 +1,0 @@
-
-public class GalconServer {
-	public static void main(String[] args) {
-		System.out.println("Great success!");
-		System.out.println("Test!");
-	}
-
-}
Index: src/GameRoom.java
===================================================================
--- src/GameRoom.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
+++ src/GameRoom.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
@@ -0,0 +1,39 @@
+import java.util.Vector;
+
+
+public class GameRoom extends Thread{
+	private final int maxNumberOfPlayers;
+	private final String roomName;
+	private Vector<Connection> players; 
+	
+	public GameRoom(int maxNumberOfPlayers, String roomName) {
+		this.maxNumberOfPlayers = maxNumberOfPlayers;
+		this.roomName = roomName;
+		this.players =  new Vector<Connection>();
+	}
+
+	public boolean addPlayer(Connection newPlayer){
+		if(maxNumberOfPlayers > players.size()){
+			players.add(newPlayer);
+			return true;
+		}
+		return false;
+	}
+	
+	
+	public void run() {
+		
+	}
+	
+	public int getNumberOfPlayers(){
+		return players.size();
+	}
+	
+	public int getMaxNumberOfPlayers(){
+		return maxNumberOfPlayers;
+	}
+	
+	public String getRoomName(){
+		return roomName;
+	}
+}
Index: src/GameServer.java
===================================================================
--- src/GameServer.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
+++ src/GameServer.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
@@ -0,0 +1,22 @@
+import java.net.Socket;
+import java.util.Vector;
+
+
+public class GameServer {
+	private Vector<GameRoom> gameRooms;
+	private Vector<Connection> connections;
+	
+	public GameServer(){
+		gameRooms = new Vector<GameRoom>(); 
+		connections = new Vector<Connection>();
+		GameRoom temp = new GameRoom(4,"Pupsik - 1");
+		temp.run();
+		gameRooms.add(temp);
+	}
+	
+	public void addConnection(Socket clientSocket) {
+		Connection temp = new Connection(clientSocket,"noob");
+		temp.start();
+		connections.add(temp);
+	}
+}
Index: src/MessageType.java
===================================================================
--- src/MessageType.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
+++ src/MessageType.java	(revision 34ccb37911f839f63ad48d4f407209cebc3f5e6b)
@@ -0,0 +1,26 @@
+
+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
+}
