2020
10-20
10-20
C/C++ 实现简易HTTP服务器的示例
#include<stdio.h>#include<stdlib.h>#include<process.h>#include<WinSock2.h>#pragmacomment(lib,"ws2_32.lib")#defineBUF_SIZE2048#defineBUF_SMALL100voidSend_404(SOCKETsock){charProtocol[]="HTTP/1.0404BadRequest\r\n";send(sock,Protocol,strlen(Protocol),0);closesocket(sock);}voidSendData(SOCKETsock,char*filename){charProtocol[]="HTTP/1.1200OK\r\n";charServerType[]="S...
继续阅读 >