cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
fcntl() + Blocking
fcntl() + Blocking
Apr 15, 2009 at 11:21pm UTC
kevinchkin
(450)
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
Apr 16, 2009 at 12:45am UTC
PanGalactic
(1658)
Surprisingly simple:
1
2
int
flags = fcntl(fd, F_GETFL);
int
result = fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
Apr 16, 2009 at 1:06am UTC
kevinchkin
(450)
You are awesome. Thanks a lot dude.
Apr 16, 2009 at 3:50am UTC
PanGalactic
(1658)
Just wait until you learn the wonders of poll(2).
:-)
Topic archived. No new replies allowed.