2012年4月12日

带外数据

摘要: 带外数据(紧急数据),服务器注册信号,signal(SIGURG, catch_sig);然后再处理函数中recv;客服端发带外数据的时候只能用send,如(sockfd, "4", 1, MSG_OOB); 阅读全文

posted @ 2012-04-12 13:56 小风儿_xf 阅读(176) 评论(0) 推荐(0) 编辑

2012年4月11日

三种网络超时检测

摘要: 三种网络超时检测 阅读全文

posted @ 2012-04-11 19:29 小风儿_xf 阅读(440) 评论(0) 推荐(0) 编辑

udp

摘要: 基本udp服务搭建 阅读全文

posted @ 2012-04-11 17:58 小风儿_xf 阅读(100) 评论(0) 推荐(0) 编辑

tcp

摘要: 基本的tcp服务搭建 阅读全文

posted @ 2012-04-11 17:57 小风儿_xf 阅读(174) 评论(0) 推荐(0) 编辑

2012年4月8日

线程互斥锁

摘要: 加锁后,另外的线程就不能来访问临界资源了,只有释放锁之后才行! 阅读全文

posted @ 2012-04-08 18:24 小风儿_xf 阅读(143) 评论(0) 推荐(0) 编辑

线程信号量

摘要: 子线程会等到主线程执行了V操作后才能往下执行 阅读全文

posted @ 2012-04-08 17:55 小风儿_xf 阅读(162) 评论(0) 推荐(0) 编辑

线程

摘要: 创建线程,记得编译的时候是 gcc pthread.c -o pthread -lpthread 阅读全文

posted @ 2012-04-08 17:18 小风儿_xf 阅读(131) 评论(0) 推荐(0) 编辑

System V信号灯

摘要: 对于临界资源,p,v操作可以保证正在执行的操作不会被另外的进程嵌套进来! 阅读全文

posted @ 2012-04-08 16:38 小风儿_xf 阅读(332) 评论(0) 推荐(0) 编辑

共享内存

摘要: #include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/types.h>#include<sys/ipc.h>#include<sys/shm.h>int main(){pid_t t;int shmid;shmid = shmget(IPC_PRIVATE, 1024, 0666);//创建共享内存system("ipcs -m");t = fork();if(t == 0){//childsleep(3);char *b;b 阅读全文

posted @ 2012-04-08 14:21 小风儿_xf 阅读(201) 评论(0) 推荐(0) 编辑

信号

摘要: 1:#include<stdio.h>#include<stdlib.h>#include<signal.h>void f(int reg){printf("the signal handle!\n");}int main(){signal(SIGINT, f);//注册一个信号,接收到时进入处理函数fpause();return 0;}2:#include<stdio.h>#include<stdlib.h>#include<signal.h>#include<sys/types.h>#i 阅读全文

posted @ 2012-04-08 11:45 小风儿_xf 阅读(119) 评论(0) 推荐(0) 编辑

导航