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

Function main

lib_acl_cpp/samples/aio/websocket/main.cpp:261–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261int main(int argc, char* argv[])
262{
263 int ch, conn_timeout = 5, rw_timeout = 5;
264 acl::string addr("127.0.0.1:80");
265 acl::string host("www.baidu.com");
266 std::vector<acl::string> name_servers;
267 bool debug = false;
268
269 while ((ch = getopt(argc, argv, "hs:N:H:t:i:D")) > 0) {
270 switch (ch) {
271 case 'h':
272 usage(argv[0]);
273 return (0);
274 case 's':
275 addr = optarg;
276 break;
277 case 'N':
278 add_dns(name_servers, optarg);
279 break;
280 case 'H':
281 host = optarg;
282 break;
283 case 't':
284 conn_timeout = atoi(optarg);
285 break;
286 case 'i':
287 rw_timeout = atoi(optarg);
288 break;
289 case 'D':
290 debug = true;
291 break;
292 default:
293 break;
294 }
295 }
296
297 acl::acl_cpp_init();
298 acl::log::stdout_open(true);
299
300 // ���� AIO �¼�����
301 acl::aio_handle handle(acl::ENGINE_KERNEL);
302
303 //////////////////////////////////////////////////////////////////////
304
305 if (name_servers.empty()) {
306 name_servers.push_back("8.8.8.8:53");
307 }
308
309 for (std::vector<acl::string>::const_iterator cit = name_servers.begin();
310 cit != name_servers.end(); ++cit) {
311
312 // ���� DNS ������������ַ
313 handle.set_dns((*cit).c_str(), 5);
314 }
315
316
317 // ��ʼ�첽����Զ�� WEB ������
318 websocket_client* conn = new websocket_client(handle, host);

Callers

nothing calls this directly

Calls 15

acl_cpp_initFunction · 0.85
beginMethod · 0.80
set_dnsMethod · 0.80
request_headerMethod · 0.80
set_keep_aliveMethod · 0.80
accept_gzipMethod · 0.80
usageFunction · 0.70
add_dnsFunction · 0.70
getoptFunction · 0.50
emptyMethod · 0.45
push_backMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…