摘要: 服务器: 1: 2: #include 3: #include 4: #include 5: #include 6: #include 7: #include 8: #include 9: 10: 11: #define N 256 12: 13: typedef struct sockaddr SA; 14: 15: int main(int argc, char* argv[]) 16: { 17: int sockfd; 18: struct sockaddr... 阅读全文
posted @ 2013-03-16 16:55 摩斯电码 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 1: /* 2: * ===================================================================================== 3: * 4: * Filename: client.c 5: * 6: * Description: 7: * 8: ... 阅读全文
posted @ 2013-03-16 16:07 摩斯电码 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 发送端: 1: /* 2: * ===================================================================================== 3: * 4: * Filename: client.c 5: * 6: * Description: 7: * 8: * Version: 1.0 9: * Created: 03/14/2013 01:48:12 PM 10: * Revision... 阅读全文
posted @ 2013-03-16 16:05 摩斯电码 阅读(589) 评论(0) 推荐(0) 编辑
摘要: 客户端: 1: #include <string.h> 2: #include <stdio.h> 3: #include <stdlib.h> 4: #include <strings.h> 5: #include <sys/un.h> 6: #include <sys/socket.h> 7: #include <netinet/in.h> 8:... 阅读全文
posted @ 2013-03-16 16:04 摩斯电码 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 服务器端: 1: #include <stdio.h> 2: #include <stdlib.h> 3: #include <strings.h> 4: #include <sys/un.h> 5: #include <string.h> 6: #include <sys/socket.h> 7: #include <netinet/in.h> 8... 阅读全文
posted @ 2013-03-16 16:03 摩斯电码 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 僵尸进程: 第一种,在父进程中通过调用waitpid; 第二种,在父进程中将子进程结束时产生SIGCHLD信号忽略; 第三种,在子进程中再次创建孙子进程,然后子进程退出,孙进程被init进程收养,它退出后,init进程将其回收,但子进程还得自己回收。 第一种 1: /* 2: * =================================================... 阅读全文
posted @ 2013-03-16 14:30 摩斯电码 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 代码: 1: /* 2: * ===================================================================================== 3: * 4: * Filename: cap.c 5: * 6: * Description: 7: * 8: * Version: 1.0 9: * Created: 03/15/2013 11:23:38 AM 10: * Revision: n... 阅读全文
posted @ 2013-03-16 13:10 摩斯电码 阅读(655) 评论(0) 推荐(0) 编辑