You are here : cpp0getsockopt

getsockopt() - 0

getsockopt - get the socket options.
The getsockopt() function retrieves the value for the option specified by the option_name argument for the socket specified by the socket argument. If the size of the option value is greater than option_len, the value stored in the object pointed to by the option_value argument will be silently truncated. Otherwise, the object pointed to by the option_len argument will be modified to indicate the actual length of the value.


Syntax

int getsockopt(int socket, int level, int option_name, 
     void *option_value, socklen_t *option_len);


Example


Output / Return Value

Upon successful completion, getsockopt() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.


Limitations

Available only for Unix/Linux.


Alternatives / See Also


Reference

http://pubs.opengroup.org/onlinepubs/7908799/xns/getsockopt.html