Half A Message Left
A server registers each connected socket with EPOLLIN | EPOLLET and runs this loop. All sockets are non-blocking.
for (;;) {
int n = epoll_wait(ep, evs, MAX, -1);
for (int i = 0; i < n; i++) {
char buf[1024];
ssize_t r = read(evs[i].data.fd, buf, sizeof buf);
if (r > 0) handle(buf, r);
}
}
A client sends 2048 bytes in one write and then waits for the reply. What happens?
Sign in to answer questions and track your progress
Sign In