Comparison between boost. ASIO and ace on socket programming-simple log-Netease blog
Comparison of socket programming between boost. ASIO and ACE
2010-05-17 17:36:52| Category:C/C ++ boost| Tag: |Font Size LargeMediumSmall Subscription
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-basedProgramDevelopment.
Recently analyzed ASIOSource codeI 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.
Boost: ASIO is a high-performance network development library,Use iocp in windows and epoll in Linux. Unlike ace, it does not provide a network framework,Instead, the application interface is provided through components.. However, in common cases, using a good framework can simplify the development process, especially the usage of ASIO asynchronous interfaces is quite similar.
Boost. ASIO is a C ++ network library that utilizes modern c ++ advanced methods for cross-platform and asynchronous I/O models.
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.
8. 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.