当前位置: 首页>>代码示例>>C++>>正文


C++ StringStorage::appendChar方法代码示例

本文整理汇总了C++中StringStorage::appendChar方法的典型用法代码示例。如果您正苦于以下问题:C++ StringStorage::appendChar方法的具体用法?C++ StringStorage::appendChar怎么用?C++ StringStorage::appendChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringStorage的用法示例。


在下文中一共展示了StringStorage::appendChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateSecConnection

void SecurityPipeServer::generateSecConnection(Channel *tempPublChan)
{
  NamedPipe *otherSideChannel = 0;

  try {
    DataInputStream svcInput(tempPublChan);
    DataOutputStream svcOutput(tempPublChan);

    UINT32 procId = svcInput.readUInt32();
    // Check the id. If it is "right" process then generate
    // transport handles specially for it.
    if (!Environment::isItTheSamePathAsCurrent(procId)) {
      throw Exception(_T("The process that has requested connection")
                      _T(" to the log server has not access right"));
    }
    // Give to process exclusive pipe handles

    StringStorage randomName;
    srand((unsigned)time(0));
    for (int i = 0; i < 20; i++) {
      randomName.appendChar('a' + rand() % ('z' - 'a'));
    }
    PipeServer pipeServer(randomName.getString(), 0, 1000);
    otherSideChannel = PipeClient::connect(randomName.getString());
    m_secChannel = pipeServer.accept();

    HANDLE otherSideHandle = otherSideChannel->getHandle();
    svcOutput.writeUInt64((UINT64)assignHandleFor(procId, otherSideHandle));
  } catch (...) {
    if (otherSideChannel != 0) delete otherSideChannel;
    throw;
  }
  if (otherSideChannel != 0) delete otherSideChannel;
}
开发者ID:gwupe,项目名称:GwupeSupportScreen,代码行数:34,代码来源:SecurityPipeServer.cpp

示例2: shMem

DesktopServerApplication::DesktopServerApplication(HINSTANCE appInstance, const TCHAR *commandLine)
: LocalWindowsApplication(appInstance),
  m_clToSrvChan(0),
  m_srvToClChan(0),
  m_clToSrvGate(0),
  m_srvToClGate(0),
  m_dispatcher(0),
  m_updHandlerSrv(0),
  m_uiSrv(0),
  m_cfgServer(0),
  m_gateKickHandler(0),
  m_sessionChangesWatcher(0)
{
  DesktopServerCommandLine cmdLineParser;

  cmdLineParser.parse(commandLine);

  DWORD baseSessionId = WTS::getActiveConsoleSessionId();

  StringStorage pathToLog;

  cmdLineParser.getLogDir(&pathToLog);

  if (!pathToLog.endsWith(_T('\\'))) {
    pathToLog.appendChar(_T('\\'));
  }
  pathToLog.appendString(_T("dtserver.log"));
  m_log = new FileLog(pathToLog.getString(), true);
  Configurator::getInstance()->addListener(this);

  m_log->changeLevel(cmdLineParser.getLogLevel());
  Log::message(_T("Log level has been changed to %d"),
               cmdLineParser.getLogLevel());

  try {
    StringStorage shMemName;
    cmdLineParser.getSharedMemName(&shMemName);
    SharedMemory shMem(shMemName.getString(), 72);
    UINT64 *mem = (UINT64 *)shMem.getMemPointer();
    HANDLE hWrite, hRead;

    DateTime startTime = DateTime::now();

    while (mem[0] == 0) {
      unsigned int timeForWait = max((int)10000 - 
                                     (int)(DateTime::now() -
                                           startTime).getTime(),
                                     0);
      if (timeForWait == 0) {
        throw Exception(_T("The desktop server time out expired"));
      }
    }

    hWrite = (HANDLE)mem[1];
    hRead  = (HANDLE)mem[2];
    m_clToSrvChan = new AnonymousPipe(hWrite, hRead);
    Log::info(_T("Client->server hWrite = %u; hRead = %u"), hWrite, hRead);

    hWrite = (HANDLE)mem[3];
    hRead  = (HANDLE)mem[4];
    m_srvToClChan = new AnonymousPipe(hWrite, hRead);
    Log::info(_T("Server->client hWrite = %u; hRead = %u"), hWrite, hRead);

    m_clToSrvGate = new BlockingGate(m_clToSrvChan);
    m_srvToClGate = new BlockingGate(m_srvToClChan);

    m_dispatcher = new DesktopSrvDispatcher(m_clToSrvGate, this);

    m_updHandlerSrv = new UpdateHandlerServer(m_srvToClGate, m_dispatcher, this);
    m_uiSrv = new UserInputServer(m_srvToClGate, m_dispatcher, this);
    m_cfgServer = new ConfigServer(m_dispatcher);
    m_gateKickHandler = new GateKickHandler(m_dispatcher);

    m_dispatcher->resume();

    m_sessionChangesWatcher = new SessionChangesWatcher(this);
  } catch (Exception &e) {
    Log::error(e.getMessage());
    freeResources();
    throw;
  }
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:82,代码来源:DesktopServerApplication.cpp


注:本文中的StringStorage::appendChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。