web服务器实现

嵌入式WEB服务器的实现 《ARM Linux开发-warewin 2G/3G无线传输(DTU)和路由器—笔记》 5.1、Web服务器的设计原理 Web服务器的原理如下: 1、建立连接:Web服务器做为服务端监听服务端口,打开一个socket文件,Web浏览器做为客服端建立连接此服务端口。  2、发送请求:Web浏览器通过socket向Web服务器提交请求。HTTP的请求一般是GET或POST命令。 3、应答:W 阅读详情

最近工作中需要客户端和服务器使用https协议进行通信,我负责客户端程序的编写,想到以前在深入理解操作系统中看过web服务器的实现,代码整理如:

#include"apue.h"

extern char **environ;
void clienterror(int fd,char *cause,char *errnum,char *shortmsg,char *longmsg)
{
    char buf[MAXLINE],body[MAXLINE];
    sprintf(body,"<html><title>Tiny Error</title>");
    sprintf(body,"%s<body bgcolor=""ffffff"">\r\n",body);
    sprintf(body,"%s%s:%s\r\n",body,errnum,shortmsg);
    sprintf(body,"%s<p>%s:%s\r\n",body,longmsg,cause);
    sprintf(body,"%s<hr><em>The tiny Web server</em?\r\n",body);

    sprintf(buf,"HTTP/1.0 %s %s\r\n",errnum,shortmsg);
    rio_writen(fd,buf,strlen(buf));
    sprintf(buf,"Content-type:text/html\r\n");
    rio_writen(fd,buf,strlen(buf));
    sprintf(buf,"Content-length:%d\r\n\r\n",(int)strlen(body));
    rio_writen(fd,buf,strlen(buf));
    rio_writen(fd,body,strlen(body));
}


void read_requesthdrs(rio_t *rp)
{

    char buf[MAXLINE];
    rio_readlineb(rp,buf,MAXLINE);
    while(strcmp(buf,"\r\n"))
    {
        rio_readlineb(rp,buf,MAXLINE);
	printf("%s",buf);
    }
    return;
}

int parse_uri(char *uri,char *filename,char *cgiargs)
{
    char *ptr;
    printf("parse_uri(uri):%s\n",uri);
    if(!strstr(uri,"cgi-bin"))
    {
        strcpy(cgiargs,"");
	strcpy(filename,".");
	strcat(filename,uri);
	if(uri[strlen(uri)-1]=='/')
	    strcat(filename,"home.html");
        return 1;
    }

    else
    {
        ptr=index(uri,'?');
	if(ptr)
	{
	    strcpy(cgiargs,ptr+1);
	    *ptr='\0';
	}
	else
	    strcpy(cgiargs,"");
         strcpy(filename,".");
	 strcat(filename,uri);
	 return 0;

    }
}


void get_filetype(char *filename,char *filetype)
{

    if(strstr(filename,".html"))
        strcpy(filetype,"text/html");
    else if(strstr(filename,".gif"))
        strcpy(filetype,"image/gif");
    else if(strstr(filename,".jpg"))
        strcpy(filetype,"image/jpeg"); 
    else
        strcpy(filetype,"text/plain");
}

void serve_dynamic(int fd,char *filename,char *caiargs)
{
    char buf[MAXLINE],*emptylist[]={NULL};

    sprintf(buf,"HTTP/1.0 200 OK\r\n");
    rio_writen(fd,buf,strlen(buf));
    sprintf(buf,"Server:Tiny Web Server\r\n");
    rio_writen(fd,buf,strlen(buf));

    if(fork()==0)
    {
        setenv("QUERY_STRING",caiargs,1);
	dup2(fd,STDOUT_FILENO);
	execve(filename,emptylist,environ);
    }
    wait(NULL);
}


void serve_static(int fd,char *filename,int filesize)
{

    int srcfd;
    char *srcp,filetype[MAXLINE],buf[MAXLINE];

    get_filetype(filename,filetype);
    sprintf(buf,"HTTP/1.0 200 OK\r\n");
    sprintf(buf,"%sServer:Tiny Web Server\r\n",buf);
    sprintf(buf,"%sContent-length:%d\r\n",buf,filesize);
    sprintf(buf,"%sContent-type:%s\r\n\r\n",buf,filetype);
    rio_writen(fd,buf,strlen(buf));

    srcfd=open(filename,O_RDONLY,0);
    srcp=mmap(0,filesize,PROT_READ,MAP_PRIVATE,srcfd,0);
    close(srcfd);
    rio_writen(fd,srcp,filesize);
    munmap(srcp,filesize);
}


void doit(int fd)
{
    int is_static;
    struct stat sbuf;
    char buf[MAXLINE],method[MAXLINE],uri[MAXLINE],version[MAXLINE];
    char filename[MAXLINE],cgiargs[MAXLINE];
    rio_t rio;

    rio_readinitb(&rio,fd);
    rio_readlineb(&rio,buf,MAXLINE);
    sscanf(buf,"%s %s %s",method,uri,version);
    if(strcasecmp(method,"GET"))
    {
        clienterror(fd,method,"501","Not implemented","Tiny does not implemented this method");
	return;
    }

    read_requesthdrs(&rio);

    is_static=parse_uri(uri,filename,cgiargs);
    if(stat(filename,&sbuf)<0)
    {
        clienterror(fd,filename,"404","Not found","Tiny couldn't find this file");
	return;
    }

    if(is_static)
    {
        if(!(S_ISREG(sbuf.st_mode))||!(S_IRUSR&sbuf.st_mode))
	{
	    clienterror(fd,filename,"403","Forbidden","Tiny could't read the file");
	    return;
	}
	serve_static(fd,filename,sbuf.st_size);
    }
    else
    {
        if(!(S_ISREG(sbuf.st_mode))|!(S_IXUSR&sbuf.st_mode))
	{
	    clienterror(fd,filename,"403","Forbidden","Tiny could't run the CGI program");
	    return;
	}
	serve_dynamic(fd,filename,cgiargs);
    }


}

int main(int argc,char **argv)
{
    int listenfd,connfd,port,clientlen;
    struct sockaddr_in clientaddr;

    if(argc!=2)
    {
        fprintf(stderr,"usage:%s <port> \n",argv[0]);
	exit(0);
    }

    port=atoi(argv[1]);

    listenfd=open_listenfd(port);
    while(1)
    {
        clientlen=sizeof(clientaddr);
	connfd=accept(listenfd,(SA*)&clientaddr,&clientlen);
	doit(connfd);
	close(connfd);
    }
}

我们可以直接使用浏览器测试上面的程序,比如当前服务器程序的目录下面有一个index.html,只要我们在浏览器中输入:

localhost:<port>/index.html就可以请求到index.html

服务器端收到的浏览器请求行如下:


基于HTTP协议实现简易Web服务器 C/S结构,即Client/Server(客户机/服务器)结构,是大家熟知的软件系统,通过将任务合理分配到Client端和Server端,降低了系统的通讯开销,可以充分利用两端硬件环境的优势。早期的软件系统多以此作为首选设计标准。而与之相对应的就是现代社会十分流行的B/S结构。而B/S结构,即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,是对C/S结构的一种变化或者改进的结构。 阅读详情

相关推荐

Python实现简单的Web服务器

互联网在过去20年里已经大大地改变了我们的生活方式,影响着社会。但是反观互联网,它的基础-web的核心原理并没有改变多少。大部分web系统仍旧遵守 Tim Berners-Lee 20 多年前提出的 W3C 标准,大部分web服务器接收的信息格式与接收的方式与过去并无二致。

全网120W+关注AI拉呱,专注人工智能以及科技前沿! 3418

C语言 : strcmp与strncmp详解

strcmp与strncmp都是用来比较字符串的,区别在于能否比较指定长度字符串。 strcmp 设这两个字符串为str1,str2, 若str1==str2,则返回零; 若str1 > str2,则返回正数; 若str1< str2,则返回负数。 即:两个字符串自左向右逐个字符相比(按ASCII值大小相比较),直到出现不同的字符或遇’\0’为止。 如: strcmp(“abcd”,”abcd”)的返回值是 0; strcmp(“abcd”,”dcba”)的返回值是 -1; strcmp.

Specif1c的博客 3836

基于linux c实现web服务器

基于linux通过c实现web服务器,适合新手 学习了知识点,然后通过项目巩固一下知识点,也可以了解http协议。

strcmp的坑

strcmp的坑 下面的程序是通过对输入进行判断,来决定输出内容的。 # include<stdio.h> #include<string.h> int main(){ printf("请输入: "); char buf[1024]; //这里想通过判断输入是否是quit来决定是否完成阅读 if (fgets(buf, sizeof(buf), stdin) != NULL && (strcmp(buf, "quit"))){

helloworlddm的博客 1553

简单web服务器实现

完整的课程设计实验报告,亲测可用,直接按照说明搭建使用。

AutoCAD 2024 LISP实用技巧:自定义快捷命令与高效绘图工具集

本文详细介绍了如何在AutoCAD 2024中部署和使用LISP脚本,打造高效绘图工具集。通过自定义快捷命令,如WFF(超级文字查找替换)、GQT(图层隔离)和LLTJ(智能长度统计),可大幅简化图层管理、文字编辑和测量统计等重复性操作,显著提升绘图效率。

gan8painter的博客 317

【项目】实现web服务器

实现:从用户输入网页地址,到建立连接、获取和分析请求、对有参数的请求进行CGI机制处理(CGI机制:用户会访问web服务器的任意文件,服务器需要依靠参数对文件进行处理,不能把处理方法放在web服务器的代码下,因为用户只会访问它需要的,那么大量的处理方法是无意义的,而且内容太多了)、构建和发送响应的全过程;

m0_72964546的博客 933

Prompt Airlines CTF通关实战:从提示词注入到多模态攻击的AI安全攻防演练

提示词注入(Prompt Injection)是当前大语言模型(LLM)应用面临的核心安全威胁之一,其原理在于攻击者通过精心构造的用户输入,覆盖或绕过系统预设的指令,从而操控模型行为。这种攻击手法的技术价值在于揭示了AI系统在理解与执行指令时存在的逻辑边界模糊性,可能导致数据泄露、越权访问等严重风险。在应用场景上,从基础的客服对话到结合视觉识别的多模态系统,都可能成为攻击面。本文以一场名为“Prompt Airlines CTF”的实战挑战为例,深入剖析了包括指令遗忘、上下文注入、工具调用滥用及多模态提示注

aodan5477的博客 515

tinyhttpd代码

/* J. David's webserver */ /* This is a simple webserver. * Created November 1999 by J. David Blackstone. * CSE 4344 (Network concepts), Prof. Zeigler * University of Texas at Arlington */ /* This program compiles for Sparc Solaris 2.6. * To compil.

jia2938724298的博客 333

智能车竞赛轮腿穿越组:GPS+IMU导航绕桩实战技巧(附避坑指南)

本文详细介绍了智能车竞赛轮腿穿越组中GPS+IMU导航绕桩的实战技巧,包括硬件选型、传感器标定、路径规划及多传感器数据融合策略。通过实际案例和避坑指南,帮助参赛队伍提升导航精度和稳定性,避免常见错误。特别强调IMU安装位置和标定对导航系统的重要性。

gin88的博客 583

GameFramework教程✨六、怎样加载一个3D UI

怎样加载一个3D UI

星河造梦坊 1582

C语言实现简单的Web服务器

个人博客主页 https://www.boolo.top C语言实现简单的Web服务器。之前的文章利用C语言实现了基于TCP的WinSock套接字编程。基于此,同样可以使用C语言来实现简单的Web服务器

城南以南花亦开 1万+

YOLOv11涨点改进 | Conv篇/小目标改进 | YOLOv11引入SPDConv卷积特征无损下采样模块,增加YOLOv11小目标P2检测层(助力小目标任务高效涨点)

本文提出了一种创新的SPDConv模块来优化YOLOv11模型,通过空间到深度(SPD)层和非步幅卷积层实现特征无损下采样。该方法有效解决了传统CNN中因跨步卷积和池化层导致的细粒度信息丢失问题,特别提升了小目标检测性能。实验表明,SPDConv在目标检测和图像分类任务中显著优于现有SOTA模型。文章详细介绍了模块原理、核心代码实现,并提供了YOLOv11集成SPDConv的具体方法,包括配置文件修改和P2层增强等优化技巧。该技术为计算机视觉任务提供了一种高效的特征保留方案。

Ai缝合怪、助力小伙伴高效发论文 586

一个简单web服务器的实现

一个简单的web服务器在不考虑其性能及健壮性的情况下,通常只需实现的功能包括服务器的启动,它用于监听某一个端口,接收客户端发来的请求,并将响应结果返回给客户端。本文将介绍一个简单web服务器的实现原理,它本身只能处理某个目录下的静态资源文件(文本、图片等)。采用java来实现的话,可以含以下几个模块,而且各个模块间的关系如图1所示。 图1、简单web服务器的模块  Http

zhaozheng7758的专栏 4万+

如何解决Elsevier和IEEE期刊之间参考文献的转换问题

Elsevier期刊和IEEE旗下的期刊两者模版互相转换的时候,会发现Elsevier模版的参考文献是存放在.bib文件下的,然后在.tex文件中直接引用即可。3. 在IEEE的.tex文件中的\end{document}命令行之前,添加下面的这句话(ps:\bibliography{**}中的**名称即为.bib文件的名称)如何将Elsevier的参考文献快速的转成IEEE期刊可用的格式,是本博客需要解决的问题。2. 将下载好的.bib文件,上传到IEEE的latex文件中。

薰珞婷紫小亭子的博客 1674

【知识分享】什么是同轴传输线结构?

同轴传输线的几何形状由中心导体组,嵌在介电材料(Dielectric)中,并且,被连续的外导体所包围,也被称为屏蔽(Shield)。内外导体有相同的几何中心轴,因此得名同轴(Coaxial)。

一只豌豆象的博客 2371

用Java实现Web服务器

来源:JAVA中文站   摘要:WWW的工作基于客户机/服务器计算模型,由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间采用超文本传送协议(HTTP)进行通信,HTTP协议的作用原理包括四个步骤:连接,请求,应答。根据上述HTTP协议的作用原理...

大树下那片阴凉 1634

《FPGA接口与协议》专栏的说明与导航

《FPGA接口与协议》专栏的说明与导航(建议阅读)。

孤独的单刀 17万+

一步一步实现一个简单的web服务器

一.实现一个tcp/ip服务器 二.实现一个web服务器,并且能够返回指定内容 三.实现一个web服务器,并且能够返回某个html页面 四.实现一个web服务器,并且能够返回多种内容 五.报错解决

nfsp412的博客 4596

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

C++实现的web服务器

C++实现的web服务器

weixin_37603532的博客 1423

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

用Java实现Web服务器 HTTP协议

用Java实现Web服务器广西财政高等专科学校 徐 辉  一、HTTP协议的作用原理  HTTP协议的作用原理包括四个步骤:1.连接:Web浏览器与Web服务器建立连接。2.请求:Web浏览器通过socket向Web服务器提交请求。3.应答:Web浏览器提交请求后,通过HTTP传送给Web服务器。Web服务器接到请求后,进行事务处理,处理结果又通过HTTP传回给Web浏览器,从而在Web浏

hem的专栏 2303

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

简易Web服务器实现

手痒就自己实现了一下简易的web服务器,由于只是简易的web服务器,所以并没有什么特别高深的技术含量。 1.      TCP通信(socket) 2.      IO流 3.      线程池技术 服务器架构也简单: Request类主要是实现解析URL的功能,以获取html文件的路径。 Response类实现读取html文件并且向浏览器输出html文件内容。 Serv

路漫漫 始于足下 2698

C#实现WEB服务器

C#实现WEB服务器www.itonline.gd.cn  这只是一个简单的用C#写的WEB服务器,只实现了get方式的对html文件的请求,有兴趣的朋友可以在此基础之上继续开发更多功能,小弟学c#不久,如有错漏,望请见凉!! 摘要:WWW的工作基于客户机/服务器计算模型,由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间采用超文本传送协议(HTTP)进行

肄若芸(yiruoyun)的专栏 2216

c#实现简单Web服务器

一、HTTP协议的作用原理 WWW是以Internet作为传输媒介的一个应用系统,WWW网上最基本的传输单位是Web网页。WWW的工作基于客户机/服务器计算模型,由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间采用超文本传送协议(HTTP)进行通信。HTTP协议是基于TCP/IP协议之上的协议,是 Web浏览器和Web服务器之间的应用层协议,是通用的、无状态的、面向对象的协议

超纯的小白兔 4726
上一篇: win7在64位系统下编译openssl
下一篇: binder机制(上篇)
OS技术解密
博客等级 码龄16年 3760粉丝 189原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值