Git Product home page Git Product logo

tiny's Introduction

Tiny Web server

author: [email protected]
一个基于线程池的并发服务器,在linux下编写。支持简单的GET请求,静态服务在/目录下,实现了显示图片,文本,下载文件等功能。
动态服务在/cgi-bin/目录下,目前只有一个简单的加法器。使用了线程池,对共享资源进行加锁控制,确保程序的正确性,用到了生产者消费者模型,主线程接收连接,生产资源,消费线程从共享buffer里取出连接描述符,提供服务.

使用方法:

  1. make
  2. 运行./tiny port即可开启服务器
  3. 现在可以在浏览器中使用ip地址:端口号(port)的方式访问服务器了。如(127.0.0.1:8080/home.html显示主页)

文件说明:

  • csapp.c对unix常见函数进行了包装,提供了错误处理。
  • csapp.h提供csapp.c的函数原型。
  • sbuf.c用结构实现了一个线程池。
  • subf.h提供sbuf.c里的结构和函数原型
  • tiny.c服务器主程序,实现服务器的主要功能
  • /cgi-bin/adder.c 主要用于生成adder cgi程序.
  • 其他文件用于提供静态服务

tiny's People

Contributors

akxxsb avatar

Watchers

James Cloos avatar tianlin avatar

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.