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

Function session

example/echo_server_MT.cpp:9–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7io_context worker[worker_num], balancer;
8
9task<> session(int sockfd) {
10 co_context::socket sock{sockfd};
11 char buf[8192];
12 int nr = co_await sock.recv(buf);
13
14 while (nr > 0) {
15 nr = co_await (sock.send({buf, (size_t)nr}) && sock.recv(buf));
16 }
17}
18
19task<> server(const uint16_t port) {
20 acceptor ac{inet_address{port}};

Callers 1

serverFunction · 0.70

Calls 2

recvMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected