public String connectToServer(int port, String host)
	{
		PORT = port;
		HOST = host;

		/**
		 *  Trying to establish a connection to the server
		 *  in the try/catch block below.
		 */
		try
		{
			connectionToServer = new Socket(HOST,PORT); // Attempt to establish a connection to the server...

			/* Establish streams to communicate with the server */

			outToServer = new PrintWriter(connectionToServer.getOutputStream(), true); // Attempt to get a stream out to the server, that we can write data to!
			inFromServer = new BufferedReader(new InputStreamReader(connectionToServer.getInputStream())); // Attempt to get a stream in from the server, that we can read data from!

			String connectionResponse = inFromServer.readLine();
			String connectionResponseProcessed[] = connectionResponse.split(" ");

			if(connectionResponseProcessed[0].equals("MAXCONNECTIONS")) {
				MAXIMUM_CONNECTIONS = Integer.parseInt(connectionResponseProcessed[1]);
				System.out.println("Maximum supported connections by server: " + MAXIMUM_CONNECTIONS);
			} else {
				System.out.println("Server didn't report the maximum number of connections it supports - this could be a problem!");
			}
			
			CONNECTED = true;
			return "CONNECTEDTO " + HOST;
		}
		// This exception is thrown if we can't find the host to start with.
		// Possibly caused by an invalid domain/IP.
		catch(UnknownHostException hostException)
		{
			System.out.println("Failed to find host.");
			hostException.printStackTrace();
		}
		// This exception is thrown if we get to the host, but can't reach
		// the server afterwards. Perhaps because of a firewall, or the fact
		// that the server might not be running anyway.
		catch(IOException ioException)
		{
			System.out.println("Failed to read from server...");
			System.out.println("This means that the host could be reached, but an error occured when we got there!");
			System.out.println("Perhaps the server isn't running, or is behind a firewall?");
			ioException.printStackTrace();
		}
		return "NOCONNECTION";
	}