代码拉取完成,页面将自动刷新
#pragma once
#include <iostream>
#include <string>
#define Die(code) \
do \
{ \
exit(code); \
} while (0)
#define CONV(v) (struct sockaddr *)(v)
enum
{
USAGE_ERR = 1, // 使用错误
SOCKET_ERR, // 创建套接字错误
BIND_ERR, // 绑定错误
LISTEN_ERR // 监听失败
};
const int gdefaultsockfd = -1;
const int gbacklog = 8;
// 1.正常字符串 2.out空串&&返回值是true 3.out空串&&返回值是false
bool ParseOneLine(std::string &str,std::string *out,const std::string &sep)
{
auto pos = str.find(sep);
if(pos == std::string::npos) return false;
*out = str.substr(0,pos);
str.erase(0,pos+sep.size());
return true;
}
// Connection: keep-alive
bool SplitString(const std::string &header,const std::string &sep,std::string *key,std::string *value)
{
auto pos = header.find(sep);
if(pos == std::string::npos) return false;
*key = header.substr(0,pos);
*value = header.substr(pos + sep.size());
return true;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。