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

Function create_tcp_sock

adapter/micro_thread/echo.cpp:14–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14int create_tcp_sock()
15{
16 int fd;
17 fd = socket(AF_INET, SOCK_STREAM, 0);
18 if (fd < 0) {
19 fprintf(stderr, "create tcp socket failed, error: %m\n");
20 return -1;
21 }
22 if (set_fd_nonblock(fd) == -1) {
23 fprintf(stderr, "set tcp socket nonblock failed\n");
24 return -1;
25 }
26
27 return fd;
28}
29
30void echo(void *arg)
31{

Callers 1

echo_serverFunction · 0.85

Calls 2

set_fd_nonblockFunction · 0.85
socketFunction · 0.70

Tested by

no test coverage detected