Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 535
madz Avatar asked Oct 21 '22 18:10

madz


1 Answers

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.

like image 77
randomusername Avatar answered Oct 27 '22 22:10

randomusername



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!