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

Function session

example/echo_server.cpp:4–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace co_context;
3
4task<> session(int sockfd) {
5 co_context::socket sock{sockfd};
6 char buf[8192];
7
8 while (true) {
9 int nr = co_await sock.recv(buf);
10 co_await sock.send({buf, (size_t)nr});
11 }
12}
13
14task<> server(const uint16_t port) {
15 acceptor ac{inet_address{port}};

Callers 1

serverFunction · 0.70

Calls 2

recvMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected