Code Room
Code reviewMediumcr-g590
Subject Socket short writeLevel Mid–Senior~18 minCommon in Networking & APIs interviewsIndustries Software development, Telecom

Question

Review this C function that sends a buffer over a connected socket.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewc
int send_all(int fd, const char *buf, size_t len) {    ssize_t n = send(fd, buf, len, 0);    if (n < 0) {        perror("send");        return -1;    }    return 0;}
Run or narrate your approach, then ask the coach.