| 259 | } |
| 260 | |
| 261 | int 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); |
nothing calls this directly
no test coverage detected
searching dependent graphs…