madz
madz

Reputation: 1873

Setting a socket nonblocking after a blocking connect

Is it safe to do connect() in blocking and after that, make the socket nonblock and do all nonblocking stuff for example epoll()/select()?

Does it cause to lack of some nonblocking operation that might I'm not considering?

Upvotes: 5

Views: 1019

Answers (1)

randomusername
randomusername

Reputation: 8087

It's perfectly safe so long as you make sure to check the return value of fnctl for an error. If not, then you could find your program halting unexpectedly.

Upvotes: 3

Related Questions