- epoll.c includes both server-end and client-end code.
- please refer to epoll for details.
open 4 terminals: t1, t2, t3 and t4. t1 is used for starting echo server, t2 and t3 are used for starting clients, t4 is used for monitoring the connections.
root:epoll-example# ./a.out -c
input: hello world
echo: hello world
input:
root:epoll-example# ./a.out -c
input: The epoll API performs a similar task to poll(2): monitoring multiple file descriptors to see if I/O is possible on any of them.
echo: The epoll API performs a similar task to poll(2): monitoring multiple file descriptors to see if I/O is possible on any of them.
input: I'm geeksword, guy
echo: I'm geeksword, guy
input:
root:epoll-example# ./a.out -s
[+] connected with 127.0.0.1:40380
[+] data: hello world
[+] connected with 127.0.0.1:40383
[+] data: The epoll API
[+] data: performs a si
[+] data: milar task to po
[+] data: ll(2): monitorin
[+] data: g multiple file
[+] data: descriptors to s
[+] data: ee if I/O is pos
[+] data: sible on any of
[+] data: them.
[+] data: I'm geeksword, g
[+] data: uy
root:epoll-example# netstat --inet -n |grep 8080
tcp 0 0 127.0.0.1:40383 127.0.0.1:8080 ESTABLISHED
tcp 0 0 127.0.0.1:40380 127.0.0.1:8080 ESTABLISHED
tcp 0 0 127.0.0.1:8080 127.0.0.1:40380 ESTABLISHED
tcp 0 0 127.0.0.1:8080 127.0.0.1:40383 ESTABLISHED