fcntl() + Blocking

Hi Guys,

I have a quick question, I have set up a socket file descriptor to non-blocking mode using fcntl() function call. Now how do I set this back to blocking mode?

Thanks a lot in advance

Surprisingly simple:

1
2
int flags = fcntl(fd, F_GETFL);
int result = fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);

You are awesome. Thanks a lot dude.
Just wait until you learn the wonders of poll(2).

:-)
Topic archived. No new replies allowed.