PowerTCP Mail for .NET
NoDelay Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Tcp Class : NoDelay Property




Gets and sets a value the disables the use of Nagle's algorithm so that data is sent immediately.

Syntax

Visual Basic (Declaration) 
<DefaultValueAttribute()>
<CategoryAttribute("Socket Options")>
<DescriptionAttribute("Gets and Sets a value the disables the use of Nagle's algorithm so that data is sent immediately.")>
Public Property NoDelay As Boolean
Visual Basic (Usage)Copy Code
Dim instance As Tcp
Dim value As Boolean
 
instance.NoDelay = value
 
value = instance.NoDelay
C# 
[DefaultValueAttribute()]
[CategoryAttribute("Socket Options")]
[DescriptionAttribute("Gets and Sets a value the disables the use of Nagle's algorithm so that data is sent immediately.")]
public bool NoDelay {get; set;}
Managed Extensions for C++ 
[DefaultValueAttribute()]
[CategoryAttribute("Socket Options")]
[DescriptionAttribute("Gets and Sets a value the disables the use of Nagle's algorithm so that data is sent immediately.")]
public: __property bool get_NoDelay();
public: __property void set_NoDelay( 
   bool value
);
C++/CLI 
[DefaultValueAttribute()]
[CategoryAttribute("Socket Options")]
[DescriptionAttribute("Gets and Sets a value the disables the use of Nagle's algorithm so that data is sent immediately.")]
public:
property bool NoDelay {
   bool get();
   void set (    bool value);
}

Property Value

false if Nagle's algorithm is to be used; otherwise true. The default value is false.

Example

The following example demonstrates some of the lesser used Tcp component members.
Visual BasicCopy Code
' Disable UI events.
Tcp1.DoEvents = False

' Enable KeepAlive socket option
Tcp1.KeepAlive = True

' Disable use of Nagle's Algoritm
Tcp1.NoDelay = True

' Read urgent data as normal in-line data.
Tcp1.OutOfBandInline = True

' Allow addresses to be reused
Tcp1.ReuseAddress = True

' Connect
Tcp1.Connect("atropos", 7)

' Send data
Tcp1.Send("test")

' Receive response
Dim seg As Segment = Tcp1.Receive()
C#Copy Code
// Disable UI events.
tcp1.DoEvents = false;

// Enable KeepAlive socket option
tcp1.KeepAlive = true;

// Disable use of Nagle's Algoritm
tcp1.NoDelay = true;

// Read urgent data as normal in-line data.
tcp1.OutOfBandInline = true;

// Allow addresses to be reused
tcp1.ReuseAddress = true

// Connect
tcp1.Connect("atropos", 7);

// Send data
tcp1.Send("test");

// Receive response
Segment seg = tcp1.Receive();

Remarks

When small pieces of data (such as a byte) are send many times consecutively, inefficiency can result because a packet could be sent with 1 byte of useful data and 40 bytes of header information. Nagle's algorithm specifies that data such as this should be automatically concatenated and sent in a single packet. When true, Nagle's algorithm is defeated and data is immediately sent in a dedicated packet. When false, Nagle's algorithm is used so consecutive Send methods might send data as a single (more efficient) packet.

Setting this property to true could result in a speed optimization (because packets is sent immediately, without having to wait to see if Tcp.Send is called again). Setting this property to false results in data being transmitted more efficiently.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.