private void connectToServer(String serverIP, int serverPort, int serverPort2)
	{
		if(socket_messages != null && socket_files != null)
		{
			try
			{
				socket_messages.close();
				socket_files.close();
				
				logText("Client has been disconnected from server " + srvIP + ":" + SERVER_MESSAGES_PORT + "!");
			}
			catch(Exception ex) {}			
		}
		
		srvIP = serverIP;
		enableThreads = false;
		
		frame.setTitle("Client " + serverIP + ":" + serverPort);
		logText("Connecting to " + serverIP + ":" + serverPort + "...");
		
		try
		{
			socket_messages = new Socket();
			socket_messages.connect(new InetSocketAddress(srvIP, SERVER_MESSAGES_PORT), 8000);
			socket_messages.setSoTimeout(8000);

			socket_files = new Socket();
			socket_files.connect(new InetSocketAddress(srvIP, SERVER_FILES_PORT), 8000);
			socket_files.setSoTimeout(8000);
		}
		catch(Exception ex)
		{
			socket_messages = null;
			socket_files = null;
		}
		finally
		{
			if(socket_messages != null && socket_files != null)
			{
				try
				{
					ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(socket_messages.getOutputStream()));
					oos.writeObject(new DataPackage("username", username));
					oos.flush();

					ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(socket_messages.getInputStream()));
					DataPackage data = (DataPackage) ois.readObject();
					
					if(data.OBJECT_NAME.equals("message"))
					{
						logText(data);
					}
					
					client_state = 0;
					enableThreads = true;
					disconnected = false;
					showDisconnectMessage = true;
				}
				catch(Exception ex) {}
			}
			else
			{
				logText("Cannot connect to the server!");
			}
		}
	}