上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 36 下一页

2021年5月25日

摘要: DIR* dir = opendir(strPath); if (dir == NULL) { perror("opendir err"); return -1; } char bufline[1024] = {0}; struct dirent* dent = NULL; while((dent= 阅读全文
posted @ 2021-05-25 01:04 lodger47 阅读(24) 评论(0) 推荐(0)

2021年5月24日

摘要: 比较 int strcasecmp (const char *s1, const char *s2);用来比较参数s1 和s2 字符串,比较时会自动忽略大小写的差异 阅读全文
posted @ 2021-05-24 13:58 lodger47 阅读(24) 评论(0) 推荐(0)
摘要: 比较符: == 等于 != 不等于 > 大于 < 小于 >= 大于等于 <= 小于等于 逻辑操作符: and 两个条件同时满足 or 其中一个条件被满足 xor 有且仅有一个条件被满足 not 没有条件被满足 ip地址: ip.addr ip地址 ip.src 源ip ip.dst 目标ip 端口过 阅读全文
posted @ 2021-05-24 09:55 lodger47 阅读(329) 评论(0) 推荐(0)

2021年5月23日

摘要: #include <stdio.h> #include <event.h> int main() { char** methods = event_get_supported_methods(); int i = 0; for (i = 0; methods[i]!=NULL; ++i) { pri 阅读全文
posted @ 2021-05-23 15:33 lodger47 阅读(63) 评论(0) 推荐(0)
摘要: C / C++编程中,经常需要操作的内存可分为下面几个类别 名称 介绍 栈区(stack) 由编译器自动分配与释放,存放函数的参数值,局部变量,临时变量等等,它们获取的方式都是由编译器自动执行的 堆区(heap) 一般由程序员分配与释放,基程序员不释放,程序结束时可能由操作系统回收(C/C++没有此 阅读全文
posted @ 2021-05-23 00:28 lodger47 阅读(227) 评论(0) 推荐(0)

2021年5月22日

摘要: #include <stdio.h> #include <sys/types.h> #include <arpa/inet.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/epoll.h> #i 阅读全文
posted @ 2021-05-22 16:12 lodger47 阅读(202) 评论(0) 推荐(0)
摘要: // 这是描述符为非阻塞 int flags =fcntl(cfd,F_GETFL); flags |= O_NONBLOCK; fcntl(cfd,F_SETFL,flags); 其他功能 阅读全文
posted @ 2021-05-22 15:57 lodger47 阅读(46) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <sys/epoll.h> int 阅读全文
posted @ 2021-05-22 15:15 lodger47 阅读(123) 评论(0) 推荐(0)
摘要: 如果对方异常断开,本机检测不到,一直等待,浪费资源 需要设置tcp的保持连接,作用就是每隔一定的时间发送探测分节,如果连续发送多个探测分节对方还未回,就将其连接断开 keepAlive=1; setsockopt(listenfd,SOL_SOCKET,SO_KEEPALIVE,(void*)&ke 阅读全文
posted @ 2021-05-22 00:38 lodger47 阅读(120) 评论(0) 推荐(0)
摘要: | 状态 | 解释 | | | | | CLOSED | 表示初始状态 | | LISTEN | 表示服务器端的某个SOCKET处于监听状态,可以接受连接了 | | SYN_RCVD | 表示接受到了SYN报文,此这种状态时,当收到客户端的ACK报文后,它会进入到ESTABLISHED状态。 | | 阅读全文
posted @ 2021-05-22 00:00 lodger47 阅读(169) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 36 下一页

导航