MSG_NOSIGNAL is a flag used by send() in some implementations of the Berkeley sockets API.
This flag requests that the implementation does not to send a SIGPIPE signal on errors on stream oriented sockets when the other end breaks the connection. The EPIPE error is still returned as normal.
Though it is in some Berkely sockets APIs (notably Linux) it does not exist in what some refer to as the reference implementation, FreeBSD, which instead uses a socket option SO_NOSIGPIPE?. 對於服務器端,我們可以使用這個標志。目的是不讓其發送SIG_PIPE信號,導致程序退出。
如果flags為0,則和read,write一樣的操作.還有其它的幾個選項,不過我們實際上用的很少,可以查看 Linux Programmer's Manual得到詳細解釋.
MSG_NOSIGNAL 在solaris中並沒有此標記
轉自: http://hi.baidu.com/socai/blog/item/49128a2c780c98e58b1399fb.html
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。