" -R n SO_RCVBUF option
"
case 'R': /* SO_RCVBUF socket option */
rcvbuflen = atoi(optarg);
break;
/* Set the socket send and receive buffer sizes (if specified).
The receive buffer size is tied to TCP's advertised window. */
if (rcvbuflen) {
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &rcvbuflen,
sizeof(rcvbuflen)) < 0)
err_sys("SO_RCVBUF setsockopt error");
optlen = sizeof(n);
if (getsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &n, &optlen) < 0)
err_sys("SO_RCVBUF getsockopt error");
if (n != rcvbuflen)
err_quit("error: requested rcvbuflen = %d, resulting SO_RCVBUF = %d", rcvbuflen, n);
if (verbose)
fprintf(stderr, "SO_RCVBUF = %d
", n);
}