MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/aio/aio_dns/main.cpp:51–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51int main(int argc, char* argv[])
52{
53 int ch, nthreads = 2;
54
55 while ((ch = getopt(argc, argv, "ht:")) > 0) {
56 switch (ch) {
57 case 'h':
58 usage(argv[0]);
59 return 0;
60 case 't':
61 nthreads = atoi(optarg);
62 break;
63 default:
64 break;
65 }
66 }
67
68 acl::acl_cpp_init();
69
70 acl::aio_handle handle;
71
72 acl::dns_service* server = new acl::dns_service(nthreads);
73
74 // ʹ��Ϣ���������� 127.0.0.1 �ĵ�ַ
75 if (!server->open(&handle)) {
76 delete server;
77 std::cout << "open server error!" << std::endl;
78 getchar();
79 return 1;
80 }
81
82 const char* domain = "www.baidu.com";
83 dns_result* result = new dns_result(domain);
84 server->lookup(result);
85 __ncount++;
86
87 result = new dns_result(domain);
88 server->lookup(result);
89 __ncount++;
90
91 result = new dns_result(domain);
92 server->lookup(result);
93 __ncount++;
94
95 domain = "www.sina.com";
96 result = new dns_result(domain);
97 server->lookup(result);
98 __ncount++;
99
100 domain = "www.51iker.com";
101 result = new dns_result(domain);
102 server->lookup(result);
103 __ncount++;
104
105 domain = "www.hexun.com";
106 result = new dns_result(domain);
107 server->lookup(result);
108 __ncount++;

Callers

nothing calls this directly

Calls 6

acl_cpp_initFunction · 0.85
lookupMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
openMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…