摘要: //通过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) 编辑