Implementation of a cross-platform static Web server from zero

Source: Internet
Author: User

Junior to end, want to write something, one is to accumulate some technology, second, for the next semester internship to do preparation, or resume on the project experience really nothing to write.

The bottom-level of C + + is the operating system and various protocols and memory layouts, and Java is the JVM. If you don't want to write a generic application, then implement a cross-platform, static Web server from 0.


Encapsulates the various classes across platforms: Socket classes with TCP and UDP, HTTP packet parsing and generation classes, and a class that reads HTML files


The result of the operation is quite good, under the Windows platform

Server Startup


Handling Browser Requests



Browser display

When we request a Web page that does not exist



Running results under the Linux platform




Browser display


Because the test is only available, so the HTML file is relatively simple, you can also put other HTML files in the project root folder.


Interested can go to the next source code

Source Code Link: http://download.csdn.net/detail/kyt511/8864901



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Implementation of a cross-platform static Web server from zero

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.