上一页 1 2 3 4 5 6 7 8 ··· 19 下一页
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <time.h> #include <errno.h> #in 阅读全文
posted @ 2022-09-08 10:51 东宫得臣 阅读(31) 评论(0) 推荐(0) 编辑
摘要: #include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int accept(int sockfd, const struct sockaddr *cliaddr, socklen_t *addrlen); accept函数由TCP服务器调用,用于从已完成 阅读全文
posted @ 2022-09-07 11:10 东宫得臣 阅读(255) 评论(0) 推荐(0) 编辑
摘要: #include <sys/socket.h> /*返回:若成功则为0,若出错则为-1*/ int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen); sockfd是由socket函数返回的socket描述符; 第二 阅读全文
posted @ 2022-09-07 10:05 东宫得臣 阅读(33) 评论(0) 推荐(0) 编辑
摘要: #include <sys/socket.h> /*返回:若成功则为非负描述符,若出错则为-1*/ int socket(int family, int type, int protocol); family参数指明协议族,也常被称为协议域; AF_INET IPv4协议 AF_INET6 IPv6 阅读全文
posted @ 2022-09-06 18:13 东宫得臣 阅读(19) 评论(0) 推荐(0) 编辑
摘要: IPv4 socket地址结构通常也称为“网际socket地址结构”,它以sockaddr_in命名,定义在<netinet/in.h> struct in_addr { in_addr_t s_addr; /*32-bit IPv4 address*/ }; struct sockaddr_in 阅读全文
posted @ 2022-09-06 17:32 东宫得臣 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c 阅读全文
posted @ 2022-09-06 15:05 东宫得臣 阅读(13) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <time.h> #include <errno.h> #include <string.h> const 阅读全文
posted @ 2022-09-06 15:02 东宫得臣 阅读(40) 评论(0) 推荐(0) 编辑
摘要: #include <unistd.h> #include <stdio.h> #include <stdlib.h> const int BUFFSIZE=4096; int main(int argc, char *argv[]) { int n; char buf[BUFFSIZE]; whil 阅读全文
posted @ 2022-06-22 10:37 东宫得臣 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 文件映射:文件映射将一个文件的一部分直接映射到调用进程的虚拟内存中。 一旦一个文件被映射之后就可以通过在相应的内存区域操作字节来访问文件内容了。 #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <stri 阅读全文
posted @ 2022-05-06 15:49 东宫得臣 阅读(461) 评论(0) 推荐(0) 编辑
摘要: UNIX系统内部对时间的表示方式均是自Epoch以来的秒数来度量的,Epoch亦即通用协调时间的1970年1月1日早晨零点。 这是UNIX系统问世的大致日期,日历时间存储于类型为time_t的变量中。 系统调用gettimeofday(),可于tv指向的缓存区中返回日历时间。 #include <s 阅读全文
posted @ 2022-04-14 20:22 东宫得臣 阅读(23) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 19 下一页