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

Function main

lib_acl_cpp/samples/tcp_pool/server/main.cpp:48–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int main(int argc, char* argv[])
49{
50 int ch;
51 acl::string addr("127.0.0.1:8887");
52
53 while ((ch = getopt(argc, argv, "hs:i:")) > 0) {
54 switch (ch) {
55 case 'h':
56 usage(argv[0]);
57 return 0;
58 case 's':
59 addr = optarg;
60 break;
61 case 'i':
62 __nstep = atoi(optarg);
63 break;
64 default:
65 usage(argv[0]);
66 return 1;
67 }
68 }
69
70 acl::server_socket ss;
71 if (ss.open(addr) == false) {
72 printf("listen on %s error %s\r\n", addr.c_str(), acl::last_serror());
73 return 1;
74 }
75 else
76 printf("listen on %s ok\r\n", addr.c_str());
77
78 __atomic = acl_atomic_new();
79 acl_atomic_set(__atomic, &__count);
80 acl_atomic_int64_set(__atomic, 0);
81
82 while (true) {
83 acl::socket_stream* conn = ss.accept();
84 if (conn == NULL) {
85 printf("accept error %s\r\n", acl::last_serror());
86 break;
87 }
88
89 acl::thread* thread = new client_thread(conn);
90 thread->start();
91 }
92
93 acl_atomic_free(__atomic);
94 return 0;
95}

Callers

nothing calls this directly

Calls 11

acl_atomic_newFunction · 0.85
acl_atomic_setFunction · 0.85
acl_atomic_int64_setFunction · 0.85
acl_atomic_freeFunction · 0.85
usageFunction · 0.70
getoptFunction · 0.50
last_serrorFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45
acceptMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…