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

Function server

example/redis_echo.cpp:15–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15task<> server() {
16 acceptor ac{inet_address{port}};
17 for (int sockfd; (sockfd = co_await ac.accept()) >= 0;) {
18 co_spawn(reply(co_context::socket{sockfd}));
19 }
20}
21
22int main() {
23 io_context ctx;

Callers 1

mainFunction · 0.70

Calls 3

co_spawnFunction · 0.85
acceptMethod · 0.80
replyFunction · 0.70

Tested by

no test coverage detected