let rec printer s r w =
(* We begin, as usual, by reading a line from the TCP connection. *)
Reader.read_line r >>= function
| `Eof -> return ()
(* Except this time, we inspect the data to see if it's the work "exit". If
* it is, we terminate. *)
| `Ok "exit" -> return ()
(* Otherwise, we echo the data and recurse. *)
| `Ok x -> (Writer.write_line w x; printer s r w)