Do I have to wait for signals with select() in order to send something in non-blocking sockets ? What if I have always have something to send and then I call send() function ? I mean, everytime i call send(), there is definitely some data to send with fixed length. Does it mean that send will not block ?
Share
A call to
sendwill never block on a non-blocking socket. If the data could not be sent (for example if the send buffer is full), thensendwill return immediately with a value ofSOCKET_ERROR.Any call that would block is signaled by an error code of
WSAEWOULDBLOCK(by callingWSAGetLastError).The same is true for a call to
receive, if there is no data in the receive buffer, the call still returns immediately, with an error.