networking · beginner · ~15 min
Hand out monotonically increasing ids.
Implement int next_conn_id(int *counter) returning the current value of *counter and then incrementing it (post-increment), so each accepted connection gets a unique id.
int next_conn_id(int *counter) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.