public Date getServerDate(int port){
		Date date = null;
		if(port == LOGIN_PORT || port == CHAT_PORT){
			try {
				String serverAddress = (port == LOGIN_PORT ? SERVER_ADDRESS_LOGIN : SERVER_ADDRESS_CHAT);
				Socket socket = new Socket(serverAddress, port);
				
				socket.setSoTimeout(TIMEOUT);
				
				OutputStream outputStream = socket.getOutputStream();
				ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
				objectOutputStream.writeObject("GET_DATE");
				objectOutputStream.flush();

				InputStream inputStream = socket.getInputStream();
				ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
				
				date = (Date)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 date;
	}