04 2012 档案

eclipse给力快捷键
摘要:感觉有用的快捷键! 阅读全文

posted @ 2012-04-20 16:45 小风儿_xf 阅读(163) 评论(0) 推荐(0)

java_chat
摘要:java的一些知识! 阅读全文

posted @ 2012-04-20 16:31 小风儿_xf 阅读(670) 评论(0) 推荐(0)

多组播
摘要:基本上和广播差不多,但服务器需要有加入多组播模块,运行的时候是./recv 224.10.10.1 5201 另开一个是./cli 224.10.10.1 5201 阅读全文

posted @ 2012-04-12 14:11 小风儿_xf 阅读(215) 评论(0) 推荐(0)

广播
摘要:得到sockfd的时候是用数据报套接字,另外客服端需要设置广播属性 int on = 1; Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST,&on, sizeof(on)); 阅读全文

posted @ 2012-04-12 14:07 小风儿_xf 阅读(142) 评论(0) 推荐(0)

unix域套接字
摘要:程序得到sockfd的时候需要设置成AF_LOCAL,后面地址是设置为路径; 阅读全文

posted @ 2012-04-12 14:03 小风儿_xf 阅读(256) 评论(0) 推荐(0)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

posted @ 2012-04-08 16:38 小风儿_xf 阅读(341) 评论(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 阅读(207) 评论(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 阅读(123) 评论(0) 推荐(0)

有名管道
摘要:写程序#include<stdio.h>#include<stdlib.h>#include<string.h>#include<unistd.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>int main(){int f;int fd;//char buff[10];f = mkfifo("myfifo",06666);//创建有名管道char buf[] = "abcd";fd = open(& 阅读全文

posted @ 2012-04-07 22:57 小风儿_xf 阅读(472) 评论(0) 推荐(0)

无名管道pipe
摘要:#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<string.h>int main(){pid_t pid;int pipefd[2];pipe(pipefd);pid = fork();if(pid == 0){//子进程char buf_2[20];bzero(buf_2, 20);sleep(2);read(pipefd[0], buf_2, 17);//从管道的读端读出数据printf("%s",buf_2);close(pipefd[0]); 阅读全文

posted @ 2012-04-07 20:43 小风儿_xf 阅读(200) 评论(0) 推荐(0)

进程
摘要:#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/wait.h>#include<sys/types.h>int main(){pid_t t;char buf[] = "test!";t = fork();//创建一个子进程 if(t == 0){printf("child\n");printf("C: %s\n",buf);execlp("ls","ls&quo 阅读全文

posted @ 2012-04-07 19:31 小风儿_xf 阅读(141) 评论(0) 推荐(0)

导航