howto prevent a process from terminating when writing to a broken pipe
来源:互联网 发布:淘宝店铺全套免费模板 编辑:程序博客网 时间:2024/05/17 03:00
现在编写网络程序一般都使用 boost ASIO
,但是偶尔还是会需要接触最底层的socket调用( 例如 ROS simple_message
see link: http://wiki.ros.org/simple_message ), 直接使用底层socket调用的时候会有很多坑。
例如,向关闭的 socket 进行写入(send)会导致程序退出。解决办法有很多,详见链接:http://www.microhowto.info/howto/prevent_a_process_from_terminating_when_writing_to_a_broken_pipe.html
如果是linux socke send
函数,则加上 MSG_NOSIGNAL flag 即可。该标志位会在对方不接收时(关闭的socket)不会产生 SIGPIPE 信号,这样就不会导致程序异常退出了。
关于 send, recv 的标志位表示的含义, man recv/send
阅读全文
0 0
- howto prevent a process from terminating when writing to a broken pipe
- Terminating a Process
- What makes a Unix process die with Broken pipe?
- Dropout: A Simple Way to Prevent Neural Networks from Overfitting
- Dropout:A Simple Way to Prevent Neural Networks from Overfitting
- HOW TO ;Prevent a…
- Prevent a Process from Being Created Again in VC or C#
- How to prevent from writing into USB drive by GPO
- Reading /(Writing) Data from / (to) a Descriptor (Dispatch Sources)
- python 3.5: TypeError: a bytes-like object is required, not 'str' when writing to a file
- Dropout: A Simple Way to Prevent Neural Networks from Overtting(泛读)
- 论文笔记2——Dropout:A simple way to prevent neural networks from overfitting
- 读Dropout : A simple way to prevent neural networks from overfitting
- Dropout: A Simple Way to Prevent Neural Networks from Overtting 论文阅读
- a method to prevent double click
- How to get an X11 Window from a Process ID?
- the limit to the amount of thread from a process
- Java How to get the PID from a process?
- java 最长公共子序列(LSC)问题
- [译]图像分类:数据驱动方法、K-最近邻、train/val/test分离 (2)
- Educational Codeforces Round 26 E. Vasya's Function 数学,迭代法
- 如何修改Tomcat服务器Server Locations
- Android Studio 2.2 更方便地创建JNI项目-CMake
- howto prevent a process from terminating when writing to a broken pipe
- poj 2796 单调栈
- hdu 4609 3-idiots(FFT)
- 用jspf文件做jsp页面的通用页面头
- 文章标题
- 笔记本电脑键盘帽坏掉了
- 开机LOGO更换
- 13.8-全栈Java笔记:打飞机游戏实战项目|Explode|MyGameFrame|Plane
- Android使用ksoap2调用webservice