Jaa


StreamWebSocketControl.NoDelay Property

Definition

A value that indicates whether the Nagle algorithm is used on a StreamWebSocket object.

public:
 property bool NoDelay { bool get(); void set(bool value); };
bool NoDelay();

void NoDelay(bool value);
public bool NoDelay { get; set; }
var boolean = streamWebSocketControl.noDelay;
streamWebSocketControl.noDelay = boolean;
Public Property NoDelay As Boolean

Property Value

Boolean

bool

A value that indicates whether the Nagle algorithm is used on the TCP connection of a StreamWebSocket object.

Remarks

The NoDelay property controls whether Nagle's algorithm is enabled or disabled on a StreamWebSocket object. The default value for the NoDelay property is true.

Nagle's algorithm is a technique to improving the efficiency of TCP/IP networks by reducing the number of packets that are needed to be sent over the network. The algorithm tries to deal with problems caused by an application that repeatedly emits data in small chunks. A TCP packet has a 40-byte header (20 bytes for IP and 20 bytes for TCP). So if an app sends only 4 bytes in a packet, the overhead on the packet data is very large. This can occur for a remote access protocol (telnet or secure shell, for example) where most key presses may generate only a single byte or two of data that is transmitted immediately. Over a slow link, many of these packets may be in transit over the network at the same time. Nagle's algorithm works by combining a number of small outgoing messages, and sending them all at once. When there is a sent packet for which the sender has received no acknowledgment, the sender keeps buffering output until it has a full packet's worth of output. This allows the output to be sent all at once. The impact of applying Nagle's algorithm is to increase the bandwidth at the expense of latency. A well-written app that buffers sends internally should not need to use Nagle's algorithm.

When this property is true, the StreamWebSocket will disable Nagle's algorithm on the TCP connection. This setting reduces the potential delays when sending small messages. When a StreamWebSocket is created, the default value for this property is true.

When this property is false, the StreamWebSocket will enable Nagle's algorithm on the TCP connection. This setting can increase the bandwidth at the expense of latency, but should only be used with caution. There are some adverse side effects possible when Nagle's algorithm is enabled and certain other TCP optimizations are also used.

This property may be set before the StreamWebSocket is connected. After the StreamWebSocket is connected, setting the property will result in an error.

This property sets the value of the TCP_NODELAY socket option on the TCP socket used by the StreamWebSocket .

Applies to

See also