07 2024 档案
摘要:非阻塞recv EAGAIN、EWOULDBLOCK错误码值11 返回值 含义 >0 接收字节数 0 接收FIN包,连接被对端断开 -1 (errno==EAGAIN||EWOULDBLOCK)表示还有数据未读。反之,则表示发生了错误。 //epollServer.cpp #include <std
阅读全文
摘要:bitmap 位图法,用每个bit位存储状态(如0/1),用于判断某个数据是否存在。适用于数据量很大,但状态不多的情况。 数据的取值范围[min,max],创建长度为max-min+1的bit数组bitmap,若num存在则bitmap[num]=1,否则为0。 用char数组存储,每个元素存1字节
阅读全文
摘要:1.select模型 //selectServer.cpp #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/sock
阅读全文
摘要://mthserver.cpp #include "TcpServer.h" #include "CLogFile.h" #include <string> #include <pthread.h> #include <vector> CLogFile logfile; TcpServer tcpS
阅读全文
摘要:#include "TcpServer.h" #include "CLogFile.h" CLogFile logfile; TcpServer tcpServer; void FatherEXIT(int sig) { if(sig>0) { signal(sig,SIG_IGN); signal
阅读全文