Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
会洗碗的CV工程师
engine2.0
提交
94233773
E
engine2.0
项目概览
会洗碗的CV工程师
/
engine2.0
与 Fork 源项目一致
Fork自
xc13262215230 / engine2.0
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine2.0
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
94233773
编写于
4月 14, 2023
作者:
X
xuchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
简单认识http请求
上级
b62314ae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
2 deletion
+65
-2
engine2.0/engine2.0/Depends/include/TcpServerMgr.hpp
engine2.0/engine2.0/Depends/include/TcpServerMgr.hpp
+4
-2
engine2.0/engine2.0/Doc/Record.txt
engine2.0/engine2.0/Doc/Record.txt
+20
-0
engine2.0/engine2.0/HelloHttp/ServerLog.txt
engine2.0/engine2.0/HelloHttp/ServerLog.txt
+41
-0
engine2.0/engine2.0/engine2.0.sdf
engine2.0/engine2.0/engine2.0.sdf
+0
-0
engine2.0/engine2.0/engine2.0.v12.suo
engine2.0/engine2.0/engine2.0.v12.suo
+0
-0
未找到文件。
engine2.0/engine2.0/Depends/include/TcpServerMgr.hpp
浏览文件 @
94233773
...
...
@@ -3,7 +3,8 @@
// 在不同操作系统下面选择最佳网络通信模型
#if _WIN32 // windows系统下面会定义此宏
#include "TcpIocpServer.hpp" // using iocp, only windows.
//#include "TcpIocpServer.hpp" // using iocp, only windows.
#include "TcpSelectServer.hpp" // 方便讲解
#elif __linux__ // 在linux系统下面会定义此宏
#include "TcpEpollServer.hpp" // using epoll, only linux.
#else
...
...
@@ -15,7 +16,8 @@ namespace doyou {
namespace
io
{
#if _WIN32
typedef
TcpIocpServer
TcpServerMgr
;
//typedef TcpIocpServer TcpServerMgr;
typedef
TcpSelectServer
TcpServerMgr
;
#elif __linux__
typedef
TcpEpollServer
TcpServerMgr
;
#else
...
...
engine2.0/engine2.0/Doc/Record.txt
浏览文件 @
94233773
...
...
@@ -78,5 +78,25 @@ IP直接存入黑名单中,所以,服务端获取客户端IP地址很有意
24.在一个进程中,主线程已经退出,子线程还没有退出,子线程会被破退出,同时可能出现系统错误。
25.IOCP网络模型是采用异步方式实现的。
26.当前服务器程序存在问题:客户端在发送一个随机字符串数据请求时,程序可能会崩溃。
服务器程序的健壮性有待提高。要处理这种异常情况。
27.http请求解析(简单认知:域名,IP地址,http服务器之间的关系):
示例:
// http请求行
GET /login.php HTTP/1.1\r\n
// http请求头
Host: 127.0.0.1:4567\r\nConnection: keep-alive\r\nCache-Control: max-age=0\r\nsec-ch-ua: \"Chromium\";v=\"112\", \"Microsoft Edge\";v=\"112\", \"Not:A-Brand\";v=\"99\"\r\nsec-ch-ua-mobile: ?0\r\nsec-ch-ua-p...
// http请求体为空
当在浏览器通过域名或ip+port方式可以访问http服务器,可以向指定http服务器发送一条网络消息,
示例如上。
http协议不一定是基于TCP的,只需要一个保证数据传输的协议即可。当前很多http的连接
都是通过tcp的连接方式,先通过tcp连接到服务器,再建立http协议数据的传输。所以,
通过域名或者URL也能访问到tcp的服务端,tcp服务器并不是一个web服务器,但是只要http
提供了正常的ip+port就能访问到。并且,tcp服务器收到了正确的数据。
engine2.0/engine2.0/HelloHttp/ServerLog.txt
0 → 100644
浏览文件 @
94233773
Info [2023-4-14 22:51:14]Log::setLogPath success,<ServerLog.txt,w>
Error [2023-4-14 22:51:14]Config::getStr not find <strIP>
Info [2023-4-14 22:51:14]Config::getStr strIP=any
Error [2023-4-14 22:51:14]Config::getStr not find <nPort>
Info [2023-4-14 22:51:14]Config::getInt nPort=4567
Error [2023-4-14 22:51:14]Config::getStr not find <nThread>
Info [2023-4-14 22:51:14]Config::getInt nThread=1
Error [2023-4-14 22:51:14]Config::getStr not find <nSendBuffSize>
Info [2023-4-14 22:51:14]Config::getInt nSendBuffSize=10240
Error [2023-4-14 22:51:14]Config::getStr not find <nRecvBuffSize>
Info [2023-4-14 22:51:14]Config::getInt nRecvBuffSize=8192
Error [2023-4-14 22:51:14]Config::getStr not find <nMaxClient>
Info [2023-4-14 22:51:14]Config::getInt nMaxClient=65535
Info [2023-4-14 22:51:14]-ipv4
Info [2023-4-14 22:51:14]create socket<448> success...
Info [2023-4-14 22:51:14]bind port<4567> success...
Info [2023-4-14 22:51:14]listen port<448> success...
Info [2023-4-14 22:51:15]thread<1>,time<1.004794>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:16]thread<1>,time<1.007067>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:17]thread<1>,time<1.008760>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:18]thread<1>,time<1.008488>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:19]thread<1>,time<1.008667>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:20]thread<1>,time<1.003613>,socket<448>,Accept<0>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 22:51:21]Accept_Ipv4 : 127.0.0.1
Info [2023-4-14 23:10:40]Accept_Ipv4 : 127.0.0.1
Info [2023-4-14 23:10:40]thread<1>,time<15.195773>,socket<448>,Accept<2>,Join<2>,recv<0>,msg<0>
Info [2023-4-14 23:10:40]checkHeart dead:s=496,time=1159802
Info [2023-4-14 23:10:40]~Client[sId=1 id=1 socket=496]
Info [2023-4-14 23:10:41]Client::Destory[sId=1 id=1 socket=496]
Info [2023-4-14 23:10:41]checkHeart dead:s=500,time=1159802
Info [2023-4-14 23:10:41]Accept_Ipv4 : 127.0.0.1
Info [2023-4-14 23:10:41]~Client[sId=1 id=2 socket=500]
Info [2023-4-14 23:10:41]Client::Destory[sId=1 id=2 socket=500]
Info [2023-4-14 23:10:41]thread<1>,time<1.005550>,socket<448>,Accept<1>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 23:10:43]thread<1>,time<1.006655>,socket<448>,Accept<1>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 23:10:44]thread<1>,time<1.006405>,socket<448>,Accept<1>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 23:10:45]thread<1>,time<1.008284>,socket<448>,Accept<1>,Join<0>,recv<0>,msg<0>
Info [2023-4-14 23:10:46]thread<1>,time<1.009576>,socket<448>,Accept<1>,Join<0>,recv<0>,msg<0>
engine2.0/engine2.0/engine2.0.sdf
浏览文件 @
94233773
无法预览此类型文件
engine2.0/engine2.0/engine2.0.v12.suo
浏览文件 @
94233773
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录