I'm using Boost asio to send a TCP message. I set the NO_DELAY option because this is a 'real time' control system. I see the PSH flag set in the message using Wireshark. I am happy with the performance and it is working as expected.
For interest, I decided to turn the NO_DELAY off and measure the performance difference.
I swapped my existing code:
m_tcpSocket.open(boost::asio::ip::tcp::v4());
boost::asio::ip::tcp::no_delay noDelayOption(true);
m_tcpSocket.set_option(noDelayOption);
// snip create endpoint
m_tcpSocket.connect(m_tcpServerEndpoint);
// snip build message
m_tcpSocket.send(boost::asio::buffer(pDataBuffer, size));
for
boost::asio::ip::tcp::no_delay noDelayOption(false);
m_tcpSocket.set_option(noDelayOption);
and I still see the PSH flag set.
I also tried removing the set_option code and still see it set.
In Wireshark I see:
104 - 105 SYN
105 - 104 SYN, ACK
104 - 105 ACK
104 - 105 PSH, ACK + my message
105 - 104 ACK
where 104 and 105 are IP addresses of my 2 PCs. I am also surprised that the message with my data has an ACK.
How do I turn NO_DELAY off?