MCPcopy Create free account
hub / github.com/F-Stack/f-stack / echo

Function echo

adapter/micro_thread/echo.cpp:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void echo(void *arg)
31{
32 int ret;
33 int *p = (int *)arg;
34 int clt_fd = *p;
35 delete p;
36 char buf[64 * 1024];
37 while (true) {
38 ret = mt_recv(clt_fd, (void *)buf, 64 * 1024, 0, -1);
39 if (ret < 0) {
40 printf("recv from client error\n");
41 break;
42 }
43 ret = mt_send(clt_fd, (void *)buf, ret, 0, 1000);
44 if (ret < 0) {
45 //printf("send data to client error\n");
46 break;
47 }
48 }
49 close(clt_fd);
50}
51
52int echo_server()
53{

Callers

nothing calls this directly

Calls 4

mt_recvFunction · 0.85
mt_sendFunction · 0.85
closeFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected