TCP options: Intro
According to RedHat accessories,
TCP_NODELAY: each call to write(fd, buf...) will be sent out as packet. This leads to poor overall performance when most of the writes are small. However, use writev(fd, iov...) with this option to build packet may lead to better latency.
TCP_CORK: Very impressive to describe this option as to add a cork to nic when enabled. After disabling this option, the accumulated packets are sent out immediately(the logical packets are coalesced).
Enable and disable sockopt:
// Enable int one = 1; setsockopt(descriptor, SOL_TCP, TCP_CORK, &one, sizeof(one)); // Disable int zero = 0; setsockopt(descriptor, SOL_TCP, TCP_CORK, &zero, sizeof(zero));
And no sockopts are set in default case.
Anyone is permitted to copy/use the contents and codes from this blog.
Sansna is not going to guarantee anything, Sansna will not take any responsibility of any results after using these codes/contents.