| 12 | } |
| 13 | |
| 14 | int 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 | |
| 30 | void echo(void *arg) |
| 31 | { |
no test coverage detected