8
我想在tcp套接字中使用SO_NOSIGPIPE。SO_NOSIGPIPE未被刪除
int set = 1;
setsockopt(sockDesc, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int);
,但一個錯誤來了:
error: SO_NOSIGPIPE was not declared in this scope
是否有任何需要的頭文件,要使用。我在互聯網上搜索,但沒有得到任何有用的解決方案。
可能重複[如何防止SIGPIPE(或正確處理它們)](http://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly) – 2014-11-05 08:35:23
這不是一個標準的選項,你需要找到另一種方式來處理(或忽略)信號。有關所有標準選項的列表,請參閱[this reference](http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_10_16)。 – 2014-11-05 08:36:16
也許這對你有幫助嗎? http://stackoverflow.com/q/17682349/2003898 – dhein 2014-11-05 08:38:06