GithubHelp home page GithubHelp logo

threadpool_server's Introduction

基于线程池的Web服务器

特点

  • 静态Web服务器,支持 GET 请求
  • 使用半同步/半异步模式的线程池支持对服务器的并发访问
    • 异步模式的主线程使用epoll监听socket上事件
    • 同步模式的工作线程执行HTTP请求解析以及HTTP响应构造
  • 基于有限状态自动机对HTTP请求进行解析

工作流程

使用

将测试使用的静态test.html文件放入 /var/www/html/

服务器编译与启动

mkdir build
cd build
cmake ..
make
./ThreadPool_SVR 127.0.0.1 8888

浏览器访问静态页面

浏览器中输入:127.0.0.1:8888/test.html

测试编译与启动

g++ test.cpp -o test
./test 127.0.0.1 8888 10
// 10为并发连接的个数,可设置更多作为压力测试

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.