示例#1
0
int_t main(int_t argc, char_t* argv[])
{
  if(argc < 3)
  {
    Console::errorf("error: Missing broker attributes\n");
    return -1;
  }
  String userName(argv[1], String::length(argv[1]));
  uint64_t brokerId = String::toUInt64(argv[2]);

  Log::setFormat("%P> %m");

  //for(;;)
  //{
  //  bool stop = true;
  //  if(!stop)
  //    break;
  //}

  // create connection to bot server
  Main main;
  for(;; Thread::sleep(10 * 1000))
  {
    if(!main.connect(userName, brokerId))
    {
      Log::errorf("Could not connect to zlimdb server: %s", (const char_t*)main.getErrorString());
      continue;
    }
    Log::infof("Connected to zlimdb server.");

    // wait for requests
    main.process();
    Log::errorf("Lost connection to zlimdb server: %s", (const char_t*)main.getErrorString());
  }
}
示例#2
0
int_t main(int_t argc, char_t* argv[])
{
  if(argc < 3)
  {
    Console::errorf("error: Missing session attributes\n");
    return -1;
  }
  String userName(argv[1], String::length(argv[1]));
  uint64_t sessionId = String::toUInt64(argv[2]);

  Log::setFormat("%P> %m");

  //bool stop = true;
  //while(stop);

  Main main;
  for(;; Thread::sleep(10 * 1000))
  {
    if(!main.connect(userName, sessionId))
    {
      Log::errorf("error: Could not connect to zlimdb server: %s", (const tchar_t*)main.getErrorString());
      continue;
    }
    Log::infof("Connected to zlimdb server.");

    main.process();
    Log::errorf("Lost connection to zlimdb server: %s", (const char_t*)main.getErrorString());
  }

  return 0;
}