| There are several different conventions for communicating with Winsock, and each method has distinct advantages. The question of the hour is, what are these advantages, and how does someone choose the convention that makes the most sense for their application? The choices are:
Blocking sockets - By default, a Winsock call blocks, meaning that it will not return until it has completed its task or has failed while trying.
Pure Non-blocking sockets - Calls on non-blocking sockets return immediately, even if they cannot complete their task immediately. Although this allows the program to do other things while the network operations finish, it requires that the program repeatedly poll to find out when each request has finished.
Asynchronous sockets - These are non-blocking sockets, except that you don't have to poll: the stack sends the program a special window message whenever something "interesting" happens.
select() - The select() function call is a way to block a thread until something interesting happens on any of a group of sockets. It is usually used with non-blocking sockets, in order to avoid polling. |
| |