Is there in general a speed or performance difference in blocking and non-blocking Winsock TCP Sockets? I could get the differences of both sockets but there isn't a detailed performance comparison between the two types.
Because it isn't about speed. The operations write
and read
are just memory copying in disguise. All they do is copy data to and from the kernel, respectively. I.e. they don't actually send or receive anything.
The blocking vs nonblocking feature asks: do you prefer these operations to block until completed or to return -1 and EAGAIN
in case they can't be performed immediately ? For example, you read from a socket but there's nothing in the receive buffer. Do you prefer to have recv
hanging until something comes along or to return -1 EAGAIN
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With