答复: 答复: [cpp] 想写一个微型的Web服务器,请问如何入手?

孟岩 myan at csdn.net
Mon Jul 24 22:17:28 CST 2006


这种工作我建议使用Python这样的脚本语言来做,因为是跑在本地,性能要求不高,
Python标准库里就有现成的类可用。

最简单的,这样就可以获得一个web server:

from SimpleHTTPServerr import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer

httpd = HTTPServer(('', 8086), SimpleHTTPRequestHandler)
httpd.serve_forever()

你可以自己写一个HTTPRequestHandler,这样就可以启动你自定义的服务。


-----邮件原件-----
发件人: cpp-bounces at codingnow.com [mailto:cpp-bounces at codingnow.com] 代表 夏
科艺
发送时间: 2006年7月24日 16:56
收件人: C++ Discuss Group; 'C++ Discuss Group'
主题: Re: 答复: [cpp] 想写一个微型的Web服务器,请问如何入手?

Jack,您好!

	请使用 freebsd 的一个 opensource 的 可以让你用得很舒服. 

	c 语言的。       非常简单。 就一个单个的 shttpd.c文件。 :)
祝你学的愉快。


	shttpd http://shttpd.sourceforge.net/

Overview
SHTTPD is a lightweight web server. The main design goals are the ease of
use and the ability to embed. Ideal for personal use, web-based software
demos (like PHP, Perl etc), quick file sharing. A care has been taken to
make the code secure. SHTTPD is licensed under the terms of MIT license.
Read no more! Get it and try it!

 
Features
Small. Fast. No bloat, no installation. Single 40Kb .exe, run-and-it-works
thing 
GET, POST, HEAD, PUT, DELETE methods 
CGI, SSL, digest auth, resumed download, aliases, inetd support 
Standard logging (combined format) 
Very simple and clean embedded API 
dietlibc friendly. NOT that friendly to the uClibc (*) 
 
Features that are NOT there (and probably never be)
Virtual hosts 
User home directories 
Server Side Includes 
Access Control Lists 
Keep-Alive connections 
Traffic shaping 
Portability to DOS 1.0 


======= 2006-07-24 16:41:13 您在来信中写道:=======

>
>用微软的ISAPI
> 
>
>> -----邮件原件-----
>> 发件人: cpp-bounces at codingnow.com 
>> [mailto:cpp-bounces at codingnow.com] 代表 SP Z
>> 发送时间: 2006年7月24日 AM 11:57
>> 收件人: C++ Discuss Group
>> 主题: [cpp] 想写一个微型的Web服务器,请问如何入手?
>> 
>> 我看到Google的应用程序一般都是一个后台服务+一个微型web服务器提供网页的界
面
>> 类似
>> 打开
>> http://localhost:9100/races
>> 进行一些设置,然后通过form在post后台处理,保存..
>> 
>> 但是C++中如何实现一个微型web服务器,是否有什么开源库的网络库(最好不要象ACE
>那么复杂)可以利用吗?最好可以跨平台.:)
>> 或者是直接用sdk?
>> 谢谢大家不吝赐教.
>> 
>> --
>> I'm Earth-Man.
>> 
>> 
>
>_______________________________________________
>Cpp mailing list
>Cpp at codingnow.com
>http://codingnow.com/mailman/listinfo/cpp
>

= = = = = = = = = = = = = = = = = = = =
			

   With 
	Best Regard!
 
				 
        夏科艺
        kxia at corp.netease.com
          2006-07-24


_______________________________________________
Cpp mailing list
Cpp at codingnow.com
http://codingnow.com/mailman/listinfo/cpp



More information about the Cpp mailing list