This repo used as an example to demonstrate how to use epoll
in a single thread, served both as client and server.
- Eliminate the use of hard-coded address and port.
- Add example of
kqueue
, and maybeiocp
. - Exploring
io_uring
. - Refactor, especially add more comments.
- Compile
main.cpp
usingg++ main.cpp -lpthread -o main
- Running
main
./main
- In another machine, use a
tcp server
listen to the port50007
nc -l 50007
- In another machine, use a
tcp client
connect to the port50007
nc <ip> 50007
- Try to send some data to the server or send data back from server to the client, and see the result. You could also use multiple clients to connect to the server.