Hi,
I understood that both of them disable Nagle's algorithm.
When should/ shouldn't I use each one of them?
Thank you.
Hi,
I understood that both of them disable Nagle's algorithm.
When should/ shouldn't I use each one of them?
Thank you.
Here is a great article describes how each one of them works. Worth reading.
It's an optimisation, so like any optimisation:
Basically the aim is to avoid having to send out several frames where a single frame can be used, with sendfile() and its friends.
So for example, in a web server, you send the headers followed by the file contents, the headers will be assembled in-memory, the file will then be sent directly by the kernel. TCP_CORK allows you to have the headers and the beginning of the file sent in a single frame, even with TCP_NODELAY, which would otherwise cause the first chunk to be sent out immediately.