Home > Blockchain >  What does "corking" mean in "UDP tracks corking status"?
What does "corking" mean in "UDP tracks corking status"?

Time:12-03

What does corking mean in UDP tracks corking status?

UDP tracks corking status through the pending variable. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1e0c14f49d6b393179f423abbac47f85618d3d46

CodePudding user response:

UDP_CORK is a UDP socket option that allows you to accumulate data, only transmitting it in a single datagram when the option is disabled.

(There's also the similar MSG_MORE flag for send that behaves similarly, accumulating data until a call is performed without the flag, as well as TCP_CORK for TCP).

The pending variable in this case is being used by the UDP code to keep track of whether data is pending transmission (i.e, if it was previously corked) or not.

CodePudding user response:

Just to expand on Hastrkun's answer, from the man page:

UDP_CORK (since Linux 2.5.44)
      If this option is enabled, then all data output on this
      socket is accumulated into a single datagram that is
      transmitted when the option is disabled.  This option
      should not be used in code intended to be portable.
  • Related