上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: //利用信号处理技术消灭僵尸进程;#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <signal.h>#include <sys/types.h> void read_childproc(int sig){ int s 阅读全文
posted @ 2021-02-09 16:18 诗和远方* 阅读(101) 评论(0) 推荐(0) 编辑
摘要: //利用sigaction函数进行信号处理#include <stdio.h>#include <unistd.h>#include <signal.h> void timeout(int sig){ if(sig==SIGALRM) { puts("Time out!!"); alarm(2); 阅读全文
posted @ 2021-02-09 15:37 诗和远方* 阅读(137) 评论(0) 推荐(0) 编辑
摘要: //销毁僵尸进程2#include <stdio.h>#include <stdlib.h>#include <sys/wait.h> int main(int argc, char *argv[]){ int status; pid_t pid=fork(); if (pid==0) { slee 阅读全文
posted @ 2021-02-09 00:23 诗和远方* 阅读(36) 评论(0) 推荐(0) 编辑
摘要: //通过fork函数创建进程#include <stdio.h>#include <unistd.h> int gval=10;int main(int argc, char *argv[]){ pid_t pid; int lval=20; gval++,lval+=5; pid=fork(); 阅读全文
posted @ 2021-02-08 22:04 诗和远方* 阅读(110) 评论(0) 推荐(0) 编辑
摘要: //Time-wait状态下将套接字端口号重新分配给新的套接字#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <arpa/inet.h>#include <sys/socket.h 阅读全文
posted @ 2021-02-08 20:47 诗和远方* 阅读(98) 评论(0) 推荐(0) 编辑
摘要: //更改I/O缓冲大小 //set_buffer.c#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/socket.h>void error_handling(char*message); int main(i 阅读全文
posted @ 2021-02-08 15:08 诗和远方* 阅读(82) 评论(0) 推荐(0) 编辑
摘要: //读取创建套接字时默认IO缓冲大小; //get_buf.c#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/socket.h>void error_handling(char*message); int m 阅读全文
posted @ 2021-02-08 12:03 诗和远方* 阅读(104) 评论(0) 推荐(0) 编辑
摘要: //利用getsockopt读取套接字可选项,用协议层为SQL_SOCKET,名为SO_TYPE的可选项查看套接字类型(TCP,UDP); //sock_type.c #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include < 阅读全文
posted @ 2021-02-08 12:00 诗和远方* 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 打开终端输入:getconf LONG_BIT 输出64就是说当前系统是64位的 阅读全文
posted @ 2021-02-04 10:48 诗和远方* 阅读(200) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std; enum note {middleC,Csharp,Cflat}; class Instrument{public: virtual void play(note) const{ cout<< "Instrument::p 阅读全文
posted @ 2021-02-03 17:50 诗和远方* 阅读(95) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页