Easy
recv() on a non-blocking socket with no data queued
A socket has been set to non-blocking mode with fcntl(). recv() is called while no data has arrived yet from the peer. What does recv() return?
main.cpp
int flags = fcntl(sock, F_GETFL, 0);
fcntl(sock, F_SETFL, flags | O_NONBLOCK);
char buf[256];
ssize_t n = recv(sock, buf, sizeof(buf), 0);5 of 45 in Networking