@Override
	public void run() {
		try {
			out = new PrintWriter(socket.getOutputStream(), true);
			System.out.println("outstream etablished");
			in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			System.out.println("instream etablished");
			while (name == null) {
				setChatName();
			}
			sendALL(name+ " has just logged on! :D");
			connected = true;
			while(connected){
				String receivedMSG=receive();
				if (receivedMSG!=null) {
					sendALL(name + ": " + receivedMSG);
				}
				try {
					Thread.sleep(5);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}