Muduo Network Programming Example (vii) "string and transform" connection server and its automation test

Source: Internet
Author: User

This article describes how to test a network service program with internal logic by using test harness.

The code for this article is shown in Http://code.google.com/p/muduo/source/browse/trunk/examples/multiplexer

Download Address: http://muduo.googlecode.com/files/muduo-0.2.0-alpha.tar.gz SHA1 checksum: 75a09a82f96b583004876e95105c679e64c95715

Cloud Wind in his blog mentioned the game to connect the server's functional requirements (search "practicing project"), I used C + + to achieve these requirements, and to write a supporting automated test harness, as an example of Muduo network library.

Note: The code presented in this article only realizes the basic functional requirements, does not consider the security, also does not have the special optimization performance, does not fit for the real on-line operation on the public net swims the connection server.

Functional Requirements

This connection server brings together multiple customer connections into an internal TCP connection, which acts as a "data string and transform", allowing backend logical servers to concentrate on the business without having to take into account the concurrency of multiple connections. The following is a block diagram of the system:

The role of this connection server is similar to the data selector (multiplexer) in the digital circuit, so I named it multiplexer. (In fact, io-multiplexing also takes this meaning to allow a thread-of-control to selectively handle multiple IO file descriptors.) )

(The above image is from Wikipedia, is public domain copyright)

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.