networking · intermediate · ~15 min

Non-blocking connect in progress?

Recognise the in-progress connect status.

Challenge

A non-blocking connect returns -1 with errno EINPROGRESS while the handshake runs. Implement int connect_in_progress(int err) returning 1 if err == EINPROGRESS, else 0.

Starter code

#include <errno.h>

int connect_in_progress(int err) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.