My code uses epoll for multiplexing. After EPOLLIN is encountered it reads one byte from ready socket.
read(fd, &onebyte, 1);
Can the above line return EWOULDBLOCK?
yes,
Errors:
...
EAGAIN or EWOULDBLOCK
The file descriptor fd refers to a socket and has been marked nonblocking (O_NONBLOCK), and the read would block. POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities
reference: the read() man description
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With