Debian Codegraph @

netsvcs/clients/Naming/Client/main.cpp

raw symbols SCIP
1 // Test the client-side of the ACE Name Server...
2
3 #include "ace/Service_Config.h"
4 #include "ace/Naming_Context.h"
5 #include "ace/ARGV.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/Reactor.h"
8
9 #include "Client_Test.h"
10
11 int
12 ACE_TMAIN (int, ACE_TCHAR *argv[])
13 {
14 ACE_Service_Config daemon;
15 ACE_ARGV new_args;
16
17 // Load the existing <argv> into our new one.
18 new_args.add (argv);
19 // Enable loading of static services.
20 new_args.add (ACE_TEXT ("-y"));
21 // Enable debugging within dynamically linked services.
22 new_args.add (ACE_TEXT ("-d"));
23
24 ACE_DEBUG ((LM_DEBUG,
25 ACE_TEXT ("argc = %d\n"),
26 new_args.argc ()));
27
28 // Print the contents of the combined <ACE_ARGV>.
29 for (int i = 0; i < new_args.argc (); i++)
30 ACE_DEBUG ((LM_DEBUG,
31 ACE_TEXT ("(%d) %s\n"),
32 i,
33 new_args.argv ()[i]));
34
35 if (daemon.open (new_args.argc (),
36 new_args.argv ()) == -1)
37 {
38 if (errno != ENOENT)
39 ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")),
40 1);
41 else // Use static binding.
42 {
43 ACE_ARGV args;
44
45 args.add (argv[0]);
46 args.add (ACE_TEXT ("-p10011")); // Port number.
47 ACE_Service_Object *so =
48 ACE_SVC_INVOKE (ACE_Naming_Context);
49
50 if (so->init (args.argc (),
51 args.argv ()) == -1)
52 ACE_ERROR_RETURN ((LM_ERROR,
53 ACE_TEXT ("%p\n"),
54 ACE_TEXT ("ACE_Naming_Context")),
55 1);
56 }
57 }
58
59 Client_Test test_body;
60 if (test_body.open () == -1)
61 return 1;
62
63 // Run forever, performing the configured services until we are shut
64 // down by a SIGINT/SIGQUIT signal.
65
66 ACE_Reactor::instance ()->run_reactor_event_loop ();
67 test_body.close ();
68
69 return 0;
70 }