PowerTCP Mail for .NET
Response Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : Response Class




Presents the response portion from an Internet protocol Request/Response pair.

Object Model

Response Class

Syntax

Visual Basic (Declaration) 
Public Class Response 
Visual Basic (Usage)Copy Code
Dim instance As Response
C# 
public class Response 
Managed Extensions for C++ 
public __gc class Response 
C++/CLI 
public ref class Response 

Example

The following example demonstrates closing a connection.
Visual BasicCopy Code
' First, check to see if currently connected
If Ftp1.Connected Then

   ' Close method returns an Invoke object
   Dim invoke As Dart.PowerTCP.Ftp.Invoke

   ' Attempt to close the connection by using the Close method
   Try
      invoke = Ftp1.Close()
   Catch ex As Exception
      ' An error occurred during the close attempt
      Debug.WriteLine(ex.Message)
   End Try

   If Ftp1.Connected Then
      ' For some reason the Close method did not work. Just perform a harsh abort
      Ftp1.Dispose()
      Debug.WriteLine("Unable to QUIT, connection aborted")
   Else
      Debug.WriteLine("Close successful.")
      Debug.WriteLine("Response Code From Server: " + invoke.Response.Code.ToString())
      Debug.WriteLine("Response Text From Server: " + invoke.Response.Text)
   End If

Else
   Debug.WriteLine("You are not connected")
End If
C#Copy Code
// First, check to see if currently connected
if(ftp1.Connected)
{
    // Close method returns an Invoke object
    Dart.PowerTCP.Ftp.Invoke invoke;
    
    // Attempt to Close the connection by using the Close method
    try
    {
        invoke = ftp1.Close();
    }
    catch(Exception ex)
    {
        // An error occurred during the close attempt
        Debug.WriteLine(ex.Message);
    }
    if(ftp1.Connected)
    {
        // For some reason the QUIT command did not work, just perform a "harsh" abort
        ftp1.Dispose();
        Debug.WriteLine("Unable to QUIT, connection aborted");
    }
    else
    {
      Debug.WriteLine("Close successful.");
      Debug.WriteLine("Response Code From Server: " + invoke.Response.Code.ToString());
      Debug.WriteLine("Response Text From Server: " + invoke.Response.Text);
    }
}
else{Debug.WriteLine("You are not connected");}

Remarks

Often, protocols define that commands be responded to with responses made up of a response code and response text. For example(using the FTP protocol as an example), the FTP protocol defines a command "CWD" which is a request to change the working directory. If command sent to the server was "CWD MYDIR" (a request to change to a directory called "MYDIR"), the response back from the server may be something like "200 Working Directory Changed". In PowerTCP this response is encapsulated by the Response object, allowing access to the code (through the Response.Code property), the text (through the Response.Text property), or the raw response (through the Response.ToString method). The Response object is usually a member of the Invoke object, which represents a request/response pair.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.Response

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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