TcpClient.NoDelay docs state:
Gets or sets a value that disables a delay when send or receive buffers are not full.
However, it's not clear whether this only applies to data written after it's set to true
, or to data that has been written and is now waiting, as well. I.e. When there's data in the buffer and NoDelay
is then set to true
, will the data in the buffer be sent immediately?
When there's data in the buffer and NoDelay is then set to true, will the data in the buffer be sent immediately?
No.
It gets evaluated on the next Send
with valid data.
You can verify with NoDelay = true
followed by Send
with a few bytes.
Or set NoDelay = true
without any call to Send
after and you should see no change.
I verified using Wireshark, but use whatever packet inspection tool you prefer.
TcpClient
is just a thin wrapper around Socket
, so you can use Socket.NoDelay
the same way.
Socket options are set by this method calling setsockopt
which is native code:
errorCode = UnsafeNclNativeMethods.OSSOCK.setsockopt(
m_Handle,
optionLevel,
optionName,
ref optionValue,
sizeof(int));
The actual option being set in this case is TCP_NODELAY.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With