Your code looks as though it is properly setting TCP_NODELAY
on or off. To set TCP_NODELAY
off, use:
socket.set_option(boost::asio::ip::tcp::no_delay(false));
The TCP RFC defines PSH as the push function. In short, it is a flag that informs the receiver that all data has been sent, so forward data up the protocol stack. Boost.Asio maps its API to BSD sockets, and BSD sockets do not provide a way to control the PSH flag. This is often handled by the kernel within the protocol stack, when it clears its buffer.
From TCP/IP Illustrated:
This flag is conventionally used to indicate that the buffer at the side sending the packet has been emptied in conjunction with sending the packet. In other words, when the packet with the PSH bit field set left the sender, the sender had no more data to send.
[...]
Push (the receiver should pass this data to the application as soon as possible—not reliably implemented or used).