i'm trying to use setsockopt() to turn off Nagle's algorithm and to set the send buffer to zero... is the code i'm using
below correct? and where should i place this code - after a socket() or after the connect()?
Code:
/* TCP_NODELAY to turn off Nagle's algorithm */
if(setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *) &tcpnodelay_flag, sizeof(int)) == -1)
{
perror("setsockopt (TCP_NODELAY)");
exit(1);
}
/* set SO_SNDBUF to 0 to make send buffer 0 */
if(setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *) &sendbuffer_sz, sizeof(size_t)) == -1)
{
perror("setsockopt (SO_SNDBUF)");
exit(1);
}
thanks!