Sachin Chourasiya Sachin Chourasiya - 1 year ago 127
C Question

How do I change a TCP socket to be non-blocking?

How do you make a socket non-blocking?

I am aware of the

function, but I've heard it's not always reliable.

Answer Source

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 EWOULDBLOCK if 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download