Socket Io model Summary

Source: Internet
Author: User

I recently reviewed socket programming, which is used to help myself and everyone remember.

The socket Io model can manage the communication on the socket. The details are as follows:

1. Select model:
By placing the socket into the set and filtering by the Select function, you can obtain the IO activity on the socket.

2. Wsaasyncselect model:
Register the IO activity you are interested in to the corresponding socket. If this activity occurs, it will be sent to the specified form.
Register a message.

3. Wsaeventselect model:
Register the socket activity you are interested in to the corresponding socket. If this activity occurs, the specified event is changed to the notification Status. Wait for the event object and query the IO activity on the socket corresponding to the event.

The preceding sockets have the following commonalities:
1. You can manage multiple sockets in one thread.
2. After Io activity occurs on the socket, you must perform read/write operations synchronously (if reading a large amount of data is a problem ).

4. Overlapped model:
In the same way, I/O activities on the socket are obtained through the event notification mechanism. The difference is that the operating system helps us manage the data sending and receiving activities on the socket until the activity ends.

5. Completionport model:
similar to the overlapped model, the difference is that it provides a mechanism similar to the thread pool. After overlapping Io operations are completed, will call one of the threads waiting for the overlapping Io operation to complete. This model improves efficiency through underlying optimization of the operating system. At the same time, there is no limit for a single thread of the event kernel object to wait for 64 socket events.
it is a socket model required for online games.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.