Skip to content
Search

C:setsockopt

lastmod 2018-08-17created 2016-12-295 edits

Network environments are complex and varied, and many unpredictable things happen. For this reason, depending on the type of network program, you sometimes need to adjust the details of a socket(:12). Socket details can be adjusted by manipulating socket options, and for this two functions are provided: getsockopt() and setsockopt(). As the names suggest, getsockopt is used to get the current socket option value, and setsockopt is used to change a socket option value.

Syntax

#include <sys/types.h>
#include <sys/socket.h>

int getsockopt(int  s, int level, int optname, void *optval, socklen_t *optlen);
int setsockopt(int s, int  level,  int  optname,  const  void  *optval, socklen_t optlen);

See also

Favorite site

References


  1. Joinc_-setsockopt-_Socket_option.pdf ↩