摘要: 参考链接:https://blog.csdn.net/m15511023218/article/details/87920263 参考的主要代码: auto eth0iface eth0 inet staticaddress 192.168.3.90gateway 192.168.3.1netmas 阅读全文
posted @ 2020-06-25 22:50 Ruigel1 阅读(755) 评论(0) 推荐(0) 编辑
摘要: /* 来发送单播消息 */ extern int netlink_unicast(struct sock *ssk, structsk_buff *skb, __u32 portid, int nonblock); /* ssk: netlink socket skb:skb buff 指针 por 阅读全文
posted @ 2020-06-24 22:52 Ruigel1 阅读(262) 评论(0) 推荐(0) 编辑
摘要: netlink_kernel_create内核函数用于创建 内核socket用用户态通信 static inline struct sock * netlink_kernel_create(struct net *net, intunit, struct netlink_kernel_cfg *cf 阅读全文
posted @ 2020-06-24 22:51 Ruigel1 阅读(4200) 评论(0) 推荐(0) 编辑
摘要: struct msghdr 结构体 struct iovec { /* Scatter/gather arrayitems */ void *iov_base; /*Starting address */ size_t iov_len; /* Number of bytes to transfer* 阅读全文
posted @ 2020-06-24 22:50 Ruigel1 阅读(3019) 评论(0) 推荐(0) 编辑
摘要: 参考链接:https://baike.baidu.com/item/pthread_join 函数pthread_join用来等待一个线程的结束,线程间同步的操作。 头文件 : #include <pthread.h> 函数定义: int pthread_join(pthread_t thread, 阅读全文
posted @ 2020-06-19 15:42 Ruigel1 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 获取进程ID: 原型: #include <unistd.h>pid_t getpid(void); 返回调用进程的进程ID。 获取线程ID: 原型: #include <pthread.h>pthread_t pthread_self(void); 返回调用线程的线程ID。 阅读全文
posted @ 2020-06-19 15:32 Ruigel1 阅读(1173) 评论(0) 推荐(0) 编辑
摘要: pthread_create是类Unix操作系统(Unix、Linux、Mac OS X等)的创建线程的函数。它的功能是创建线程(实际上就是确定调用该线程函数的入口点),在线程创建以后,就开始运行相关的线程函数。 头文件: #include<pthread.h> 函数原型: int pthread_ 阅读全文
posted @ 2020-06-19 15:28 Ruigel1 阅读(10909) 评论(0) 推荐(1) 编辑
摘要: 简单的说这些函数就是: 将一个数的高低位互换 主机字节顺序成为小端,网路字节顺序成为大端。 原型: #include <arpa/inet.h> uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32 阅读全文
posted @ 2020-06-18 16:59 Ruigel1 阅读(266) 评论(0) 推荐(1) 编辑
摘要: #include <iostream>#include <vector>#include <queue> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) 阅读全文
posted @ 2020-06-18 00:12 Ruigel1 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 流的状态可以通过检测ios_base类中的位来判断。 1)当输入流遇到文件尾时, eofbit位将被设置。 可以调用函数 cin.eof()来判断是否到达文件末尾 在cin中遇到问价末尾时返回true,否则返回false。 2)当在流中发生格式错误时,failbit位将被设置。 例如程序要求输入整数 阅读全文
posted @ 2020-04-29 23:20 Ruigel1 阅读(2217) 评论(0) 推荐(0) 编辑