====== SELECT model:
The SELECT model is one of the most widely used models in Winsock, the core is the SELECT function, it can be used
Determine whether there is data on the socket, or whether it can write data to a socket.
This function can effectively prevent the application from in the socket in the blocking mode, Send or Recv enters
Blocking status; it can also prevent a large number of WSAEWOULDBLOCK errors
The advantage of SELECT is to make multiple connections and I / O from multiple sockets of a thread.
This avoids threaded threads accompanying blocking sockets and multiple connections.
====== WSAASYNCSELECT model:
This is a model of my personal favorite model ^ _ ^ because it is also based on the news.
The key is the WSaasyncselect function, send the socket message to the HWND window, then there
Handle the corresponding FD_READ, FD_WRITE, etc.
advantage:
The WSaasyncselect and WSAEventselect model provide asynchronous notifications for reading and writing data capabilities, but they don't
Provide asynchronous data transfer, while overlapping and completing the transfer of asynchronous data.
And it can handle a lot of connections while the system overhead is not large, and the SELECT model needs to be established.
FD_set structure.
Disadvantages:
You must use a window to receive message -_- b
If you handle thousands of sockets, you will not be your heart.
====== WSAEventselectSelect model
This is also a time-based network event notification, but it is different from WSaasyncselect.
It is mainly done by the event object handle, not through the window.
This is a bit complicated, a half sentence is not clear ...-_- b
advantage:
No need to window
Disadvantages:
You can only wait for 64 events at a time, so it is necessary to organize a thread pool when handling multiple sockets;
Therefore, the scalability is not as good as the end of the completion.
====== overlapping model
This model allows the program to achieve more system performance. Basic design principle is to let applications
Use overlapping data structures to deliver one or more I / O requests at a time. Request for these submissions,
After they are completed, the app provides services.
It is divided into two implementation methods: use in an event, and it is completed routine, it is not very good to learn -_- b
====== Complete the port
This is the most complicated I / O model in it, the landlord is best to understand the basis of overlapping I / O.
Learn again.
Completing the port provides the best scalability, often makes the system to achieve the best performance, is processing
The first choice for thousands of sockets.
From essentially, complete the port model requires a Windows completed port object, the object
A specified number of threads are managed to manage overlap I / O to provide services for overlapping I / O requested.
* It doesn't matter if you only learn these pure theories, it is important to have more hands-on, read a model.
Just do your hand to realize it, you can truly learn ^ _ ^