public void run()
	{
		byteArray = new byte[1024];
		try
		{
			while (true)
			{
				byteArray = new byte[1024];
				receivePacket = new DatagramPacket(byteArray, byteArray.length);
				sc.getUDPsocket().receive(receivePacket);
				IPaddress = receivePacket.getAddress();
				port = receivePacket.getPort();
				byteArray = receivePacket.getData();
				String data = new String(byteArray, "UTF-8").trim();
				StringTokenizer st = new StringTokenizer(data, Protocol.DELIMITER);
				String request = st.nextToken();
				
				if(request.equals(Protocol.GET_PING))
					sc.addUserRespond(port);
				else if(request.equals(Protocol.GET_QUIT))
					sc.removeUser(port);
				else if(request.equals(Protocol.GET_JOIN))
				{
					String username = st.nextToken();
					boolean usernameTaken = false;
					for(Integer userPort : sc.getUserMap().keySet())
						if(sc.getUser(userPort).getName().equals(username))
							usernameTaken = true;
					if (usernameTaken)
						reply(Protocol.SEND_JOIN_USERNAMETAKEN);
					else if(!usernameTaken)
					{
						reply(Protocol.SEND_JOIN_ACCEPT);
						System.out.println("join test");
						sc.addUserToMap(new User(username, IPaddress, port));
						sc.getGUI().addMessage("New connection: "+username);
					}
					else
						reply(Protocol.SEND_JOIN_DECLINED);
				}
				
				else if(request.equals(Protocol.GET_MESSAGE))
				{
					String message = "";
					request = st.nextToken();
					if(request.equals(Protocol.GET_MESSAGE_PUBLIC))
					{
						String username = st.nextToken();
						while(st.hasMoreTokens())
							message += st.nextToken()+" ";
						sendPublicMessage(username, message);
					}
					else if(request.equals(Protocol.GET_MESSAGE_PRIVATE))
					{
						String usernameFrom = st.nextToken();
						String usernameTo = st.nextToken();
						while(st.hasMoreTokens())
							message += st.nextToken()+" ";
						sendPrivateMessage(usernameFrom, usernameTo, message);
					}
				}
			}
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}