MCPcopy Create free account
hub / github.com/boostorg/asio / echo

Function echo

example/cpp20/coroutines/timeout.cpp:19–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17using ip::tcp;
18
19awaitable<void> echo(tcp::socket& sock, time_point& deadline)
20{
21 char data[4196];
22 for (;;)
23 {
24 deadline = std::chrono::steady_clock::now() + std::chrono::seconds(10);
25 auto n = co_await sock.async_read_some(buffer(data), use_awaitable);
26 co_await async_write(sock, buffer(data, n), use_awaitable);
27 }
28}
29
30awaitable<void> watchdog(time_point& deadline)
31{

Callers 1

handle_connectionFunction · 0.70

Calls 4

bufferFunction · 0.85
async_writeFunction · 0.85
nowFunction · 0.50
async_read_someMethod · 0.45

Tested by

no test coverage detected