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




Gets or sets a value that controls the processing of events during blocking method calls.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Behavior")>
<DescriptionAttribute("Gets or Sets a value that controls the processing of events during blocking method calls.")>
<DefaultValueAttribute()>
Public Property DoEvents As Boolean
Visual Basic (Usage)Copy Code
Dim instance As Tcp
Dim value As Boolean
 
instance.DoEvents = value
 
value = instance.DoEvents
C# 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("Gets or Sets a value that controls the processing of events during blocking method calls.")]
[DefaultValueAttribute()]
public bool DoEvents {get; set;}
Managed Extensions for C++ 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("Gets or Sets a value that controls the processing of events during blocking method calls.")]
[DefaultValueAttribute()]
public: __property bool get_DoEvents();
public: __property void set_DoEvents( 
   bool value
);
C++/CLI 
[CategoryAttribute("Behavior")]
[DescriptionAttribute("Gets or Sets a value that controls the processing of events during blocking method calls.")]
[DefaultValueAttribute()]
public:
property bool DoEvents {
   bool get();
   void set (    bool value);
}

Property Value

true if user-interface events should be processed during synchronous method calls; otherwise, false. The default value is true.

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 performing a synchronous (blocking) method, PowerTCP will process user-interface events (such as window painting) if this property is set to true AND the current thread has an event message queue. If no message queue is present (such as on an ASP page or under any worker thread), the value of this property has no effect. This property is used only for synchronous methods. Object.DoEvents is not needed if using asynchronous methods because the asynchronous method will execute on a different thread, allowing the UI thread to continue working unblocked.

For example, this property is beneficial when an interactive application is being used and the user may want to abort a currently processing operation by clicking an "Abort" button. If Object.DoEvents is set to false, this will not be possible. Set the Object.DoEvents property to true and the application will respond to other events (such as button clicks) during synchronous operations.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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