我怎样写在C / C的Web服务器++在Linux上 [英] How do I write a web server in C/C++ on linux
问题描述
我期待到发展小(读:初级)在Linux平台上的Web服务器,我不知道从哪里开始。
I am looking into developing a small (read:rudimentary) web server on a linux platform and I have no idea where to start.
我希望它能够做的是:
- 收听特定端口上
- 以HTTP POST和get请求
- 适当响应
- 无需会话管理
- 有可能成为C或C ++
- 具有作为服务在启动运行
我所熟悉的HTTP标头和是一名经验丰富的PHP和.NET Web开发者,但我不知道从哪里开始完成这个任务。
I am familiar with HTTP headers and am an experienced PHP and .Net web developer, but I am not sure where to start with this task.
您可以告诉我有一些资源来弥补学习曲线?
Can you advise me with some resources to bridge the learning curve?
推荐答案
从自上而下的,你需要了解:
From top-down, you'll need to know about:
- HTTP协议
- TCP服务器 - BSD socket编程
- 编写一个基本的Unix守护进程(持续服务)
- 流程管理(叉)
- 解析文本(读取配置文本文件)
- 文件处理(I / O)
- 调试C / C ++编程:)
所以,你将有机会了解编写一个基本的Unix应用程序,BSD Socket编程的TCP / IP网络编程以及HTTP协议。
So you will have to learn about writing a basic Unix application, BSD socket programming for the TCP/IP network programming, and the HTTP protocol.
常用的文本包括:
Unix的应用程序开发:
Unix application development:
- 在UNIX环境中,史蒂文斯和放大器高级编程;拉戈
- 高级的Unix编程
TCP / IP(套接字)编程:
TCP/IP (sockets) programming:
- Unix网络编程,第1卷Stevens等所有
- TCP / IP详解,史蒂文斯
- 使用TCP / IP,第3卷Ineternetworking,科默
HTTP协议
- RFCs including
- RFC 2616 for HTTP v1.1,
- RFC 2068 for pre-v1.1
- plus others depending on support (compression, URI / URL) and completeness
这篇关于我怎样写在C / C的Web服务器++在Linux上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!