Ждать команды от сервера в процессе выполнения метода

У меня есть клиент и сервер. С сервера я посылаю команду, вызывающую метод, который показывает файлы в папке, для его работы надо указать путь к папке. Нужно сделать так, чтобы обработчик команд ждал команды от сервера(стринга) и после получения пути записывал его в переменную

Function Code

std::string FileManager::DirectoryObjectsList(std::string dir) {
    std::string names;
    std::string search_path = dir + "/*";
    WIN32_FIND_DATA fd;
    HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd);
    int index = 0;
    if (hFind != INVALID_HANDLE_VALUE) {
        do {
            if (index <= 1) {
                index++;
                continue;
            }
            names.append(fd.cFileName);
            names.append("%0A");
        } while (::FindNextFile(hFind, &fd));
        ::FindClose(hFind);
    }
    return names;
}
I need to set "dir" param.

у меня есть обработчик команд:

std::string General::processCommand(std::string command)
{
    else if (command == "test")
    {
        test();
        return "testing mesagebox";
    }
    else if (command == "scr")
    {
        //soon
    }
    else if (command == "FileManager")
    {
     std::string simple_dir;
     //here i need to get a path from server
     
      DirectoryObjectsList(simple_dir);
    }
    else
    {
        return "Command '" + command + "' was not recognized.";
    }
}

Ответы (0 шт):