07 2022 档案
摘要:I/O 多路复用使得程序能同时监听多个文件描述符,能够提高程序的性能,Linux 下实现 I/O 多路复用的系统调用主要有 select、poll 和 epoll。 1. select 头文件:#include <sys/select.h> 1.1、函数原型 int select(int nfds,
阅读全文
摘要:套接字函数 #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> // 包含了这个头文件,上面两个就可以省略 int socket(int domain, int type, int protocol); - 功能
阅读全文
摘要:头文件: #include <pthread.h> 1. pthread_create 一般情况下,main函数所在的线程,称之为主线程(main线程),其余创建的线程称之为子线程。 程序中默认只有一个进程,fork()函数调用,变成2个进程 程序中默认只有一个线程,pthread_create()
阅读全文