
linux回射服务器
「已注销」
这个作者很懒,什么都没留下…
展开
-
Linux回射服务器(一):多进程实现并发
建立连接后创建一个进程来处理每个连接 使用fork()函数创建子进程 服务器端:#include<sys/types.h> #include<sys/socket.h> #include<stdio.h> #include<netinet/in.h> #include<arpa/inet.h> #include<unistd.h> #include<string.h> #include<stdl原创 2017-03-21 17:34:00 · 975 阅读 · 0 评论 -
Linux并发回射服务器(二):处理僵死进程
运行三个客户端程序然后非正常结束linux下我们用ps -a命令可以查看当前进程的情况如下解决方法是利用子进程传递给父进程的信号 代码如下:#include<sys/types.h> #include<sys/socket.h> #include<stdio.h> #include<netinet/in.h> #include<arpa/inet.h> #include<unistd.h> #in原创 2017-03-21 17:59:22 · 589 阅读 · 0 评论 -
C++线程安全的单例模式
C++线程安全的单例模式首先看一下普通的单例模式实现:class singleton{ public: static singleton* getinstance(){ if(p==null){ p = new singleton(); } return p; } protect: singleton原创 2017-03-25 21:15:04 · 500 阅读 · 0 评论