#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);
Parameters
getsockopt:
int socket: ID of our created socket
int level
int option_name
void *retrict option_value
socklen_t *restrict option_len
setsockopt:
int socket: ID of our created socket
int level:
int option_name: name of the option, that gets manipulated
const void *option_value
socklen_t option_len
options:
- SO_REUSEADDR: indicates that the rules used in validating addresses supplied in a bind(2) call should allow reuse of local addresses.
return values:
- 0: if successful
- -1: otherwise and errno is set