十七

IO多路复用

1.select#include <stdio.h>#include <arpa/inet.h>#include <stdlib.h>#include <unistd.h>#include <string.h>int main() {

十七 Published on 2022-03-24

网络编程

1.字节序/* 字节序:字节在内存中存储的顺序。 小端字节序:数据的高位字节存储在内存的高位地址,低位字节存储在内存的低位地址 大端字节序:数据的低位字节存储在内存的高位地址,高位字节存储在内存的低位地址*/// 通过代码检测当前主机的字节序#include <stdio

十七 Published on 2022-03-24

多线程开发

1.进程创建/* 一般情况下,main函数所在的线程我们称之为主线程(main线程),其余创建的线程 称之为子线程。 程序中默认只有一个进程,fork()函数调用,2进行 程序中默认只有一个线程,pthread_create()函数调用,2个线程。 #include &

十七 Published on 2022-03-07

进程间通信

进程间通信1. 无名管道/* #include <unistd.h> int pipe(int pipefd[2]); 功能:创建一个匿名管道,用来进程间通信。 参数:int pipefd[2] 这个数组是一个传出参数。 pi

十七 Published on 2022-03-07

多进程开发

一、多进程开发fork函数/* #include <sys/types.h> #include <unistd.h> pid_t fork(void); 函数的作用:用于创建子进程。 返回值: fork()的

十七 Published on 2022-03-07

文件IO基础

文件IO基础open函数/* #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> // 打开一个已经存在的文件 int open(const char *pa

十七 Published on 2022-03-07