int on = 1; int error = IOCTL(server_socket, FIONBIO, &on); if (error < 0) die("Couldn't set non-blocking");