networking · beginner · ~15 min
Estimate the recv-loop iteration count.
If a client reads at most chunk bytes per recv, implement int reads_needed(int total, int chunk) returning how many recv calls are needed (ceiling), 0 if chunk <= 0.
int reads_needed(int total, int chunk) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.