#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
int port;
#define BACKLOG 5
extern int close(int fd);
//http协议text/html类型头
char *resp_header = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html;charset=UTF-8\r\n"
"Server: Wavin Web Server/1.1\r\n";
//头长度
int resp_header_len;
//模拟html文件
char *html_body = "<!DOCTYPE html>"
"<html><head>"
"<title>Welcome to Wavin Web Server (WWS)</title>"
"</head><body>Hello World</body></html>";
int get_socketfd()
{
int server_fd;
struct sockaddr_in my_addr;
resp_header_len = strlen(resp_header);
serve
C语言Socket写WEB服务器(只支持GET请求...)
最新推荐文章于 2024-05-22 22:27:05 发布
#include<stdio.h>#include<stdlib.h>#include<errno.h>#include<string.h>#include<sys/types.h>#include<netinet/in.h>#include<sys/socket.h>#include&l
摘要由CSDN通过智能技术生成