摘要: 网络编程:socket套接字 TCP编程模型 udp编程模型 阅读全文
posted @ 2017-08-16 15:33 聊哥 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 转载 http://coolshell.cn/articles/12103.html 在知乎上,有个人问了这样的一个问题——为什么vfork的子进程里用return,整个程序会挂掉,而且exit()不会?并给出了如下的代码,下面的代码一运行就挂掉了,但如果把子进程的return改成exit(0)就没 阅读全文
posted @ 2017-08-16 15:07 聊哥 阅读(8754) 评论(0) 推荐(0) 编辑
摘要: 协议架构 IP协议格式 TCP协议格式 udp协议格式 阅读全文
posted @ 2017-08-16 14:51 聊哥 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 概念:多个线程按照规定的顺序来执行,即为线程同步 扫地5次后拖地模型 #include<pthread.h>#include<stdio.h> pthread_mutex_t mut;pthread_t thread[2];int number=0; void studentA(){ int i; 阅读全文
posted @ 2017-08-16 14:19 聊哥 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 工人1 /2干活模型程序设计 #include<pthread.h>#include<stdio.h> pthread_t thread[2];int number=0;pthread_mutex_t mut;void *worker1(){ int i =0; printf("i am worke 阅读全文
posted @ 2017-08-16 10:11 聊哥 阅读(106) 评论(0) 推荐(0) 编辑