How do you set a non-blocking socket in Linux?
How do you set a non-blocking socket in Linux? To mark a socket as non-blocking, we use the fcntl system call. Here’s an example: int flags = guard(fcntl(socket_fd, F_GETFL), “could not get file flags”); guard(fcntl(socket_fd, F_SETFL, flags | O_NONBLOCK), “could not set file flags”); Here’s a complete example. How would you set a socket to…
Read More “How do you set a non-blocking socket in Linux?” »