Socket network Programming-Simple Web server (6)

Source: Internet
Author: User
Tags ssl connection

Originally wanted to achieve SSL connection, but did not succeed for a long time, simply do not do, and so on later have the ability to do. So this is the last section of this chapter. Just a few more notes.

1. Add a configuration file

Using singleton mode, use a class that holds some information, such as a string with a property of PAGE404 for a configuration class, a string that holds a file address, and then our page_404 function can use access to determine whether the file that corresponds to the PAGE404 string exists. If so if there is a 404 page then cat this file instead of the default 404 function inside the page. There's a port or something like a macro definition, instead of a magic number in a program. There are also a variety of configurations will not say much.

2. Access control

This is even easier, through a configuration file read the running IP, and the denied IP, and then in the Webserver::serveraccept () function can be judged, in this function can obtain the connection of the IP address, and then can be constrained by this IP address. Nor is it difficult.

3.siege Performance Test

This is the point of this section. (here to explain that my server performance is poor, not to spit groove.) )

: http://www.joedog.org/2013/07/siege-3-0-3-url-encoding/  

1SIEGE-C100-R5 URL #对url地址进行100个并发用户5次的测试2 ############# #我的WebServer ############3Transactions: -hits4Availability:100.00%5Elapsed Time:8.87secs6Data Transferred:0.60MB7Response Time:0.75secs8Transaction Rate:56.37trans/sec9Throughput:0.07MB/secTenConcurrency:42.26 OneSuccessful transactions: - AFailed transactions:0 -Longest transaction:3.95 -Shortest transaction:0.01 the $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -Transactions: -hits -Availability:100.00% -Elapsed Time:8.64secs +Data Transferred:0.60MB -Response Time:0.66secs +Transaction Rate:57.87trans/sec AThroughput:0.07MB/sec atConcurrency:37.96 -Successful transactions: - -Failed transactions:0 -Longest transaction:2.87 -Shortest transaction:0.01 - $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ inTransactions: -hits -Availability:100.00% toElapsed Time:8.58secs +Data Transferred:0.60MB -Response Time:0.62secs theTransaction Rate:58.28trans/sec *Throughput:0.07MB/sec $Concurrency:36.41Panax NotoginsengSuccessful transactions: - -Failed transactions:0 theLongest transaction:3.01 +Shortest transaction:0.01 A  the ############# #本地Nginx ################ +Transactions: -hits -Availability:100.00% $Elapsed Time:5.07secs $Data Transferred:0.29MB -Response Time:0.02secs -Transaction Rate:98.62trans/sec theThroughput:0.06MB/sec -Concurrency:2.40WuyiSuccessful transactions: - theFailed transactions:0 -Longest transaction:0.08 WuShortest transaction:0.00 - $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ AboutTransactions: -hits $Availability:100.00% -Elapsed Time:5.19secs -Data Transferred:0.29MB -Response Time:0.02secs ATransaction Rate:96.34trans/sec +Throughput:0.06MB/sec theConcurrency:2.40 -Successful transactions: - $Failed transactions:0 theLongest transaction:0.08 theShortest transaction:0.00 the $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ theTransactions: -hits -Availability:100.00% inElapsed Time:5.15secs theData Transferred:0.29MB theResponse Time:0.02secs AboutTransaction Rate:97.09trans/sec theThroughput:0.06MB/sec theConcurrency:1.83 theSuccessful transactions: - +Failed transactions:0 -Longest transaction:0.05 theShortest transaction:0.00Bayi ############# #本地httpd ################ theTransactions: -hits theAvailability:100.00% -Elapsed Time:5.18secs -Data Transferred:0.11MB theResponse Time:0.02secs theTransaction Rate:96.53trans/sec theThroughput:0.02MB/sec theConcurrency:2.18 -Successful transactions: - theFailed transactions:0 theLongest transaction:0.18 theShortest transaction:0.0094 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ theTransactions: -hits theAvailability:100.00% theElapsed Time:5.17secs98Data Transferred:0.11MB AboutResponse Time:0.02secs -Transaction Rate:96.71trans/sec101Throughput:0.02MB/sec102Concurrency:1.55103Successful transactions: -104Failed transactions:0 theLongest transaction:0.17106Shortest transaction:0.00107 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$108Transactions: -hits109Availability:100.00% theElapsed Time:5.14secs111Data Transferred:0.11MB theResponse Time:0.02secs113Transaction Rate:97.28trans/sec theThroughput:0.02MB/sec theConcurrency:1.77 theSuccessful transactions: -117Failed transactions:0118Longest transaction:0.12119Shortest transaction:0.00

A look to know, my server is how slag ah, not happy.

Socket network Programming--Simple Web server each chapter Portal

Socket network Programming--Simple Web server (1) http://www.cnblogs.com/wunaozai/p/3926033.html
Socket network Programming--Simple Web server (2) http://www.cnblogs.com/wunaozai/p/3936295.html
Socket network Programming--Simple Web server (3) http://www.cnblogs.com/wunaozai/p/3943952.html
Socket network Programming--Simple Web server (4) http://www.cnblogs.com/wunaozai/p/3945218.html
Socket network Programming--Simple Web server (5) http://www.cnblogs.com/wunaozai/p/3946486.html
Socket network Programming--Simple Web server (6) http://www.cnblogs.com/wunaozai/p/3949324.html

Reference: http://www.zihou.me/html/2011/01/27/2737.html

This address: http://www.cnblogs.com/wunaozai/p/3949324.html

Socket network Programming-Simple Web server (6)

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.