avatar
Articles
252
Tags
98
Categories
23

Theqiqi_blog
Search

Theqiqi_blog

101.使用Grop网站提供的api
Created2026-01-03|web server|http•c•linux•web•REST API•AI
在不同环境中调用api1.创建api key 创建api key 在gropapi.com注册账号,登录后创建一个新的api,填写相关信息后保存,系统会生成一个唯一的api key。 保存api key gropapikey1:gsk_开头的一串字符串 1gsk_开头的一串字符串 2. crul调用api使用curl发送请求查看所有可用模型 打开终端环境 运行curl带参数123curl -X GET "https://api.groq.com/openai/v1/models" \ -H "Authorization: Bearer gsk_开头的一串字符串" \ -H "Content-Type: application/json" 3.查看结果 curl调用免费模型 打开终端环境 输入命令123456789101112 curl https://api.groq.com/openai/v1/chat/completions \-H "Content-Type: application/json&qu ...
9.压测
Created2025-03-27|web server|http•linux•web•python
现在的 epoll HTTP 服务器完全可以用专业工具做压力测试,得到真实的: 最大并发连接数 最大 QPS 最大吞吐量 延迟分布(P50 / P90 / P99) CPU / 内存占用 以下是一个从简单到专业的完整测试方案,照着做就能得到真实数据。 🟩 方案 1:用 curl 做最简单的功能测试(不是压力测试)1curl -v http://127.0.0.1:8080/ 确认服务器能正常返回。 🟦 方案 2:用 ab(ApacheBench)做轻量压测这是最常用的入门压测工具。 安装: 1sudo apt install apache2-utils 测试 1000 次请求,50 并发: 1ab -n 1000 -c 50 http://127.0.0.1:8080/ 你能看到: QPS 平均延迟 失败率 并发处理能力 🟧 方案 3:用 wrk(最专业的 HTTP 压测工具)这是工业界最常用的压测工具,Nginx 官方推荐 wrk。 安装(Ubuntu): 1sudo apt install wrk 压测 30 秒,100 并发: ...
8.Linux Socket并发模型http服务器
Created2025-03-27|web server|http•c•linux•web•select•poll•epoll
并发web服务器indexl.html select123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125#include <sys/socket.h>#include <string.h>#include <unistd.h>#include <netinet/in.h>#include <stdio.h>#include <arpa/inet.h>#include <fcntl.h>#include <sys/stat.h ...
7.web服务器中收发REST接口
Created2025-03-27|web server|http•c•linux•web•REST API
1.web服务器中收发REST接口1.C语言在linux中创建web服务器收发消息 server.c 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119#include <stdio.h>#include <string.h>#include <unistd.h>#include <arpa/inet.h>void send_cors_headers(int client) { dprintf(client, "Access-Control-Allow-Ori ...
6使用c语言与linux系统写一个web服务器,解析并响应get与post请求
Created2025-03-27|web server|http•c•linux•web
web服务器,解析并响应get与post请求“GET 返回页面 + POST 处理数据” 的 Web 服务器 🌐 目标行为 ① 浏览器访问网页(GET) 1GET / → 返回 index.html ② HTML 表单提交数据(POST) 1POST /submit → 返回字符串或 JSON 1.创建index.html12345678910111213141516<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>POST 测试</title></head><body> <h1>提交数据测试</h1> <form action="/submit" method="POST"> <input type="text" name="msg" val ...
5.使用c语言与linux系统写一个静态服务器,解析并响应get请求
Created2025-03-27|web server|http•c•linux•web
静态服务器,解析并响应get请求解析 GET 请求 根据路径返回不同内容 / 或 /index.html → 返回 index.html 其他路径 → 返回 404 1.index.html12345678910111213<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Page Title</title></head><body><h1>This is a Heading</h1><p>This is a paragraph.</p></body></html> 2.server.c123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676 ...
4.使用c语言与linux系统写一个静态网页服务器,发送html文件内容
Created2025-03-27|web server|http•c•linux•web
静态网页服务器,发送html文件内容1.创建index.html 12345678910111213<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Page Title</title></head><body><h1>This is a Heading</h1><p>This is a paragraph.</p></body></html> 2.创建server.c 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293#include ...
3.使用c语言与linux系统写一个静态http网页服务器,发送一句话
Created2025-03-27|web server|http•c•linux•web
http网页服务器,发送一句话需要发送http协议头,浏览器才会解析内容。 1.创建server.c 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#include <sys/socket.h>#include <string.h>#include <unistd.h>#include <netinet/in.h>#include <stdio.h>#include <arpa/inet.h>int main(){ int s = socket(AF_INET,SOCK_STREAM,0); // Reuse address int opt = 1; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); struct sockaddr_in addr={ AF_INET, ...
2.使用c语言与linux系统写一个静态http网页文件下载服务器,发送一个文件
Created2025-03-27|web server|http•c•linux•web
http网页文件下载服务器 index.html 1Hello from server, it works! server.c 123456789101112131415161718192021222324252627282930313233343536373839#include <sys/socket.h>#include <string.h>#include <fcntl.h>#include <sys/sendfile.h>#include <unistd.h>#include <netinet/in.h>int main(){ int s = socket(AF_INET,SOCK_STREAM,0); struct sockaddr_in addr={ AF_INET, 0x901f, 0 }; bind(s, (struct ...
1.使用html+css+javascript制作静态网页
Created2025-03-27|web server|html•css•javascript
使用html+css+javascript制作网页1.使用html制作一个静态网页 创建first.html 12345678910111213<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Page Title</title></head><body><h1>This is a Heading</h1><p>This is a paragraph.</p></body></html> 浏览器打开网页。 显示成功 2.使用html与css制作一个静态网页Internal CSS first.html 12345678910111213141516171819202122<!DOCTYPE html><html><head> <meta charset="UTF-8" ...
12…26
avatar
Theqiqi
Articles
252
Tags
98
Categories
23
Follow Me
Announcement
This is my Blog
Recent Post
101.使用Grop网站提供的api2026-01-03
9.压测2025-03-27
8.Linux Socket并发模型http服务器2025-03-27
7.web服务器中收发REST接口2025-03-27
6使用c语言与linux系统写一个web服务器,解析并响应get与post请求2025-03-27
Categories
  • C with Socks16
  • C_Sound10
  • C_Windows_Graphi9
  • Cpp5
  • Cpp_Socket4
  • C语言在Windows中实现抓包4
  • C语言的万种用法9
  • Debian1
Tags
System first pragram make mysql UltraISO IPV4 WinSock GDI nasm gtest rufus AI assembly WindowsDrive sql C jsp Socket Makefile Vmware Sound OpenGl Disk MFC http Websocket UDP Npcap Hacking C++ Windows Capture ipv6 Socks qemu genisoimage epoll Http LinSock Direct2D
Archives
  • January 20261
  • March 202595
  • February 202523
  • September 20242
  • August 202471
  • June 20242
  • March 20249
  • February 20248
Info
Article :
252
UV :
PV :
Last Update :
©2020 - 2026 By Theqiqi
Framework Hexo|Theme Butterfly
Search
Loading the Database