@Override
	public boolean join(String n) {
		boolean accepted = false;

		try {
			m_connectionSocket = new Socket(K.ADDRESS_TCP, K.TCP_SERVER_PORT);

			ObjectOutputStream os = new ObjectOutputStream(
					m_connectionSocket.getOutputStream());

			// Sending join message to the server ...
			Join join = new Join(n);
			System.out.println("Sending message to server.");
			os.writeObject(join);
			os.flush();

			ObjectInputStream is = new ObjectInputStream(
					m_connectionSocket.getInputStream());
			// ... and wait for the reply.
			Object o = is.readObject();
			System.out.println("Server has replied.");

			// Check server reply
			if (o instanceof Join) {
				Join msg = (Join) o;
				accepted = msg.isAccepted();
			}
			m_connectionSocket.close();

			// Check the server reply ...
			if (accepted) {
				System.out.println("Connected");
				// ... join the multicast group
				m_multicastSocket = new MulticastSocket(K.UDP_CLIENT_PORT);
				m_multicastSocket.joinGroup(InetAddress
						.getByName(K.ADDRESS_UDP));
			} else {
				System.out.println("Connection refused");
			}

		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return accepted;
	}