Comparison of socket programming between ACE and ASIO (zz)

Source: Internet
Author: User
Ace is a very mature middleware product. It is an adaptive communication environment, but it is too ambitious. There are a bunch of design patterns, and the architecture is layer after layer. It is a little difficult for beginners.
ASIO is a basic asynchronous Io library developed by boost. It encapsulates socket and simplifies socket-based Program Development.
Recently analyzed ASIO Source code I was surprised by its design. Memory Management in ACE development has always been a headache. The emergence of ASIO makes me see the new dawn and become my new good partner. Simply make a comparison with Ace.
1. Layered Architecture:
The bottom layer of ACE is the c-style OS adaptation layer, the top layer is the c ++-based wrap class, And the next layer is some frameworks (accpetor, connector, reactor, etc ), the top layer is the Framework Service.
Similar to ASIO, the bottom layer is the OS adaptation layer. The top layer is some template classes, the top layer is the parameterization of the template classes (TCP/UDP), and the top layer is the service, it only has one framework, io_service.
2. Scope:
Ace contains logs, IPC, threads, shared memory, and Configuration Services.
ASIO only involves socket and provides simple thread operations.
3. Design Mode:
Ace mainly applies reactor and proactor.
ASIO mainly applies proactor.
4. Thread Scheduling:
The reactor of ACE is single-thread scheduling, and proactor supports multi-thread scheduling.
ASIO supports single-thread and multi-thread scheduling.
5. Event dispatch processing:
Ace is mainly used to register the handler class. When an event is assigned, it calls its handler's virtual hook function. Implement Virtual functions such as ace_handler/ace_svc_handler/ace_event_handler.
ASIO is a hanlder event dispatch based on function objects. Any function may succeed in hanlder, with less virtual table maintenance and better scheduling than Ace.
6. Release Method:
Ace is open-source and free, and does not rely on the 3rd-party library. When an application uses it, it publishes a dynamic library through dynamic links.
ASIO is open-source and free-of-charge and relies on boost. When using an application, you only need to include the header file and do not need dynamic libraries.
7. Portability:
Ace supports multiple platforms and has no portability issues. It is said that socket programming has many buckets in Linux.
ASIO supports multiple platforms and has no portability issues.
7. Development difficulty:
Developing applications based on ACE requires a high level of programmer requirements. To make good use of it, you must have a good understanding of its framework. Under its framework, developers often create a new object and do not know where to release it.
Developing applications based on ASIO requires programmers to be familiar with function objects, function pointers, and boost: bind in the boost library. Convenient memory management and control.
I personally think that if the application socket programming is used, Asio development is better and the development efficiency is higher. Ace is suitable for theoretical research, which originally originated from Douglas's academic research.

From: http://hi.baidu.com/itengfei/blog/item/69e7a01ff0612761f724e468.html

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.