The app uses a uv tcp server to open a TCP socket and listen for a client. It accepts a single TCP client and replies to all messages with the same message.
It prints the number of bytes recieved and time elapsed on client disconnect.
The app uses uv timers to track the time passed between two clients.
The app also recieves input from standard input. Echoes the same input back to standard output. It detects input on stdin by using uv polls.
- libuv
$ gcc echo_server_tcp.c -luv -o echo_server_tcp
$ ./echo_server_tcp