How do you make a socket non-blocking?
I am aware of the fcntl() function, but I’ve heard it’s not always reliable.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean by “not always reliable”? If the system succeeds in setting your socket non non-blocking, it will be non-blocking. Socket operations will return
EWOULDBLOCKif they would block need to block (e.g. if the output buffer is full and you’re calling send/write too often).This forum thread has a few good points when working with non-blocking calls.