MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / server

Function server

example/echo_server.cpp:14–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14task<> server(const uint16_t port) {
15 acceptor ac{inet_address{port}};
16 for (int sock; (sock = co_await ac.accept()) >= 0;) {
17 co_spawn(session(sock));
18 }
19}
20
21int main() {
22 io_context ctx;

Callers 1

mainFunction · 0.70

Calls 3

co_spawnFunction · 0.85
acceptMethod · 0.80
sessionFunction · 0.70

Tested by

no test coverage detected