以上英文的比较难看,给大家一个链接 http://www.linuxidc.com/Linux/2012-08/66981.htm
详细讲述了选项的使用。
RETURN VALUE
成功的话就会返回0,失败返回-1,失败的时候会这是errorno值。下面是几个选项值。
ERRORS
The setsockopt() function shall fail if:
[EBADF]
The socket argument is not a valid file descriptor.
[EDOM]
The send and receive timeout values are too big to fit into the timeout fields in the socket structure.
[EINVAL]
The specified option is invalid at the specified socket level or the socket has been shut down.
[EISCONN]
The socket is already connected, and a specified option cannot be set while the socket is connected.
[ENOPROTOOPT]
The option is not supported by the protocol.
[ENOTSOCK]
The socket argument does not refer to a socket.
The setsockopt() function may fail if:
[ENOMEM]
There was insufficient memory available for the operation to complete.
[ENOBUFS]
Insufficient resources are available in the system to complete the call.
