上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 阅读全文
posted @ 2021-11-13 18:59 Anonytt 阅读(14) 评论(0) 推荐(0) 编辑
摘要: epoll是Linux下多路复用IO接口select/poll的增强版本,它能显著提高程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率,因为它会复用文件描述符集合来传递结果而不用迫使开发者每次等待事件之前都必须重新准备要被监听的文件描述符集合,另一个原因就是获取事件的时候,它无需遍历整个被 阅读全文
posted @ 2021-11-13 11:14 Anonytt 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 运行select的server端: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<unistd.h> 5 #include<errno.h> 6 #include<pthread.h> 7 #incl 阅读全文
posted @ 2021-11-12 16:38 Anonytt 阅读(36) 评论(0) 推荐(0) 编辑
摘要: Server端: #include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<errno.h> #include<pthread.h> #include<ctype.h> #include<s 阅读全文
posted @ 2021-11-11 19:44 Anonytt 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 为什么要设定端口号: 端口号就是在统一操作系统内区分不同的套接字所设置的。 地址信息的表示: 回顾《学习笔记--01》中的bind函数 #include<sys/socket.h> int bind(int sockfd,struct sockaddr *myaddr,socklen_t addrl 阅读全文
posted @ 2021-11-09 13:39 Anonytt 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 首先要清楚什么是协议(protocol)? 简言之,协议就是为了完成数据交换而定好的约束。 回顾我们在《学习笔记 --01》中创建套接字socket中的代码: #include<sys/socket.h> int socket(int domain,int type,int protocol) | 阅读全文
posted @ 2021-11-09 13:19 Anonytt 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 1.1网络编程套接字 Server端: 网络编程中接受连接请求的套接字创建过程可整理如下: 第一步:调用socket函数创建套接字 第二步:调用bind函数分配IP地址和端口号 第三步:调用listen函数转为可接受请求状态 第四步:调用accept函数受理连接请求 sock函数:建立会话 #inc 阅读全文
posted @ 2021-11-09 13:01 Anonytt 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Django采用了MVT的软件设计模式,暨模型(Model),视图(View),模板(Template) · M:负责和数据库交互,进行数据处理。 · V:接受请求,进行业务处理,返回应答,做逻辑函数 · T:负责封装构造要返回的html MVT模型的工作流程: 路由控制器将请求转发给对应的视图函数 阅读全文
posted @ 2021-11-07 13:32 Anonytt 阅读(35) 评论(0) 推荐(0) 编辑
摘要: import urllib.request import urllib.parse url = 'https://movie.douban.com/j/chart/top_list?type=5&interval_id=100%3A90&action=&start=0&limit=20' heade 阅读全文
posted @ 2021-11-05 19:23 Anonytt 阅读(28) 评论(0) 推荐(0) 编辑
摘要: import urllib.request import urllib.parse url = "https://fanyi.baidu.com/v2transapi?from=en&to=zh" #反爬的话Cookie才是关键,需要视情况保留 headers ={ 'Cookie': 'BIDUP 阅读全文
posted @ 2021-11-05 19:03 Anonytt 阅读(778) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页