⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 ACE编程的一本经典BIBLE的源代码,喜欢网络编程的别错过
💻 CPP
字号:
// main.cpp,v 4.15 2005/01/29 05:26:52 ossama Exp

// Test the client-side of the ACE Name Server...

#include "ace/Service_Config.h"
#include "ace/Naming_Context.h"
#include "ace/ARGV.h"
#include "ace/Log_Msg.h"
#include "ace/Reactor.h"

#include "Client_Test.h"

ACE_RCSID (Client,
           main,
           "main.cpp,v 4.15 2005/01/29 05:26:52 ossama Exp")

int
ACE_TMAIN (int, ACE_TCHAR *argv[])
{
  ACE_Service_Config daemon;
  ACE_ARGV new_args;

  // Load the existing <argv> into our new one.
  new_args.add (argv);
  // Enable loading of static services.
  new_args.add (ACE_TEXT ("-y"));
  // Enable debugging within dynamically linked services.
  new_args.add (ACE_TEXT ("-d"));

  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("argc = %d\n"),
              new_args.argc ()));

  // Print the contents of the combined <ACE_ARGV>.
  for (int i = 0; i < new_args.argc (); i++)
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("(%d) %s\n"),
                i,
                new_args.argv ()[i]));

  if (daemon.open (new_args.argc (),
                   new_args.argv ()) == -1)
    {
      if (errno != ENOENT)
        ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")),
                          1);
      else // Use static binding.
        {
          ACE_ARGV args;

          args.add (argv[0]);
          args.add (ACE_TEXT ("-p10011")); // Port number.
          ACE_Service_Object *so =
            ACE_SVC_INVOKE (ACE_Naming_Context);

          if (so->init (args.argc (),
                        args.argv ()) == -1)
            ACE_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("%p\n"),
                               ACE_TEXT ("ACE_Naming_Context")),
                              1);

          so = ACE_SVC_INVOKE (Client_Test);

          if (so->init (0,
                        args.argv ()) == -1)
            ACE_ERROR ((LM_ERROR,
                        "%p\n%a",
                        "Client_Test",
                        1));
        }
    }

  // Run forever, performing the configured services until we are shut
  // down by a SIGINT/SIGQUIT signal.

  ACE_Reactor::run_event_loop ();

  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -