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




Gets the connected state of the connection.

Syntax

Visual Basic (Declaration) 
<BrowsableAttribute(False)>
Public ReadOnly Property Connected As Boolean
Visual Basic (Usage)Copy Code
Dim instance As Pop
Dim value As Boolean
 
value = instance.Connected
C# 
[BrowsableAttribute(false)]
public bool Connected {get;}
Managed Extensions for C++ 
[BrowsableAttribute(false)]
public: __property bool get_Connected();
C++/CLI 
[BrowsableAttribute(false)]
public:
property bool Connected {
   bool get();
}

Property Value

true if the TCP connection is connected to a remote resource and authenticated; otherwise, false.

Example

The following example demonstrates a logout procedure for the Pop component.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

Private Sub PopLogout()
   ' Check to see if currently connected before logging out.
   If Pop1.Connected Then
      ' Attempt to log out gracefully.
      Try
         Pop1.Logout()
      Catch ex As Exception
         ' Logout failed. Just abruptly close.
         Pop1.Dispose()
      End Try
    End If
End Sub
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Check to see if currently connected before logging out.
if(pop1.Connected)
{
   // Attempt to log out gracefully.
   try
   {
      pop1.Logout();
   }
   catch(Exception ex)
   {
      // Logout failed. Just abruptly close.
      pop1.Dispose();
   }
}

Remarks

If the PowerTCP component is connected to a remote resource AND authenticated, this property returns true. If this property is false, the connection was either never connected, is no longer connected, or is connected but not yet authenticated. When receiving data from the server, this property is a good way to tell if all data has been received. Keep receiving data in a loop until this property equals false.

When using PowerTCP components which make use of the Tcp component as the underlying connection, this property returns the same value as the Object.Connection.Connected property (where Object.Connection exposes the Tcp object used for the connection).

The Object.ConnectedChanged and Object.ConnectedChangedEx events are raised whenever this property changes.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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