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

Function main

lib_acl_cpp/samples/http/http_response/main.cpp:78–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78int main(int argc, char* argv[])
79{
80 int ch;
81 acl::string addr("0.0.0.0:8194");
82
83 while ((ch = getopt(argc, argv, "hs:")) > 0)
84 {
85 switch (ch)
86 {
87 case 'h':
88 usage(argv[0]);
89 return 0;
90 case 's':
91 addr = optarg;
92 break;
93 default:
94 break;
95 }
96 }
97
98 acl::server_socket server;
99 if (server.open(addr) == false)
100 {
101 printf("listen error, addr: %s\r\n", addr.c_str());
102 return 1;
103 }
104 printf("listen %s ok\r\n", addr.c_str());
105
106 while (true)
107 {
108 acl::socket_stream* conn = server.accept();
109 if (conn == NULL)
110 {
111 printf("accept error\r\n");
112 return 1;
113 }
114 printf("accept one: %s\r\n", conn->get_peer());
115
116 handle_request(conn);
117 }
118
119 return 0;
120}

Callers

nothing calls this directly

Calls 7

usageFunction · 0.70
handle_requestFunction · 0.70
getoptFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45
acceptMethod · 0.45
get_peerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…