Skip to main content

Checkpoint: Echo Server Core

Challenge on lesson: Checkpoint: Echo Server Core

CHALLENGE
Difficulty: advanced+25 XP

POSIX. Implement int echo_serve(int lfd) โ€” accept ONE connection on the already-bound/listening socket lfd, echo every byte received back to the client until the client half-closes (recv returns 0), close the connection, and return 0 (-1 on accept failure). The tests build a loopback listener, run echo_serve on a thread, connect, send, verify the echo, and half-close.

Back to lesson: Checkpoint: Echo Server Core