The Nagle algorithm is one of the basic algorithms of TCP that helps reduce Internet traffic by combining several small packets into a single large one. While this increases the efficiency of sending large messages such as those commonly sent in normal Internet traffic, the algorithm can introduce some latency for situations where small amounts of information are being sent back and forth, such as in instrument handshaking.
Attached is an example that contains the following VIs in LabVIEW 2012 format that turn off the Nagle algorithm for different targets:
- TCP_NoDelay.vi: Allows you to turn the Nagle algorithm off for a specific TCP connection.
- NagleDemo-MessageSender.vi: Sends two quick, 4-byte messages to NagleDemo-MessageReflector.vi. These two VIs in combinations can demonstrate the timing differences between using the Nagle algorithm and not using it.
- NagleDemo-MessageReflector.vi: Reads 8-bytes from NagleDemo-MessageSender.vi and replies back. These two VIs in combinations can demonstrate the timing differences between using the Nagle algorithm and not using it.
- TCP Get Raw Net Object.vi: Gets the raw socket used for TCP communications from the operating system so that properties can be set on it.
: These VIs were built specifically for Windows, Phar Lap ETS, VxWorks, and Linux RT. With a little modification, they can also be used on other operating systems. Refer to the block diagrams for more information.