public static void transmit() {
		ObjectOutputStream out;
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		try {
			out = new ObjectOutputStream(socket.getOutputStream());
			
			while (true) {
				String message = reader.readLine();
				
				if (message.startsWith("\\")) {
					if (message.startsWith("\\nick ")) {
						String nick = message.substring(5).trim();
						out.writeObject(new ChangeNickMessage(nick));
					} else if (message.startsWith("\\quit")) {
						System.out.println(getDate() + " Connection terminated.");
						return;
					} else {
						System.out.println("Unknown command.");
					}
				} else {
					out.writeObject(new ChatMessage(message));
				}
			}
			
		} catch (IOException e) {
			System.err.println("Cannot connect to " + server + " on port " + port + ".");
			return;
		}
	}