public ChatChannel joinChannel(ChatChannel channel, User user, boolean channelExists){
		try {
			Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT);
			
			socket.setSoTimeout(TIMEOUT);
			
			OutputStream outputStream = socket.getOutputStream();
			ObjectOutputStream objectOutputStream = new ObjectOutputStream(
					outputStream);

			objectOutputStream.writeObject((channelExists ? "JOIN_CHANNEL" : "CREATE_AND_JOIN_CHANNEL"));
			objectOutputStream.writeObject(channel);
			objectOutputStream.writeObject(user);
			objectOutputStream.flush();
			
			if(!channelExists){
				InputStream inputStream = socket.getInputStream();
				ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
				channel = (ChatChannel)objectInputStream.readObject();
			}

			socket.close();
			
		}catch (SocketException e){
			new ErrorFrame("Server unreachable!");
		} catch (SocketTimeoutException e){
			new ErrorFrame("Connection timed out");
		} catch (Exception e) {
			new ErrorFrame("An unknown Error occoured");
		}
		return channel;
	}