setsockopt (sys/socket.h)
- by lojin
The prototype for setsockopt is:
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
Are the following all correct ? Which are not ?
a.)
int buffsize = 50000;
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&buffsize, sizeof(buffsize));
b.)
int buffsize = 50000;
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&buffsize, sizeof(buffsize));
c.)
char *buffsize = "50000";
setsockopt(s, SOL_SOCKET, SO_RCVBUF, buffsize, strlen(buffsize));
d.)
setsockopt(s, SOL_SOCKET, SO_RCVBUF, "50000", 5);