See Also

Response Members  | Dart.PowerTCP.Ftp Namespace

Requirements

Namespace: Dart.PowerTCP.Ftp

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Assembly: Dart.PowerTCP.Ftp (in Dart.PowerTCP.Ftp.dll)

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Requirements Languages PowerTCP FTP for .NET

Response Class

Dart.PowerTCP.Ftp Namespace : Response Class (Dart.PowerTCP.Ftp)

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

For a list of all members of this type, see Response members.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Ftp.Response

Syntax

[Visual Basic]
Public Class Response
[C#]
public class Response
[C++]
public __gc class Response
[C++/CLI]
public ref class Response

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 Code property), the text (through the Text property), or the raw response (through the ToString method). The Response object is usually a member of the Invoke object, which represents a request/response pair.

Example

The following example demonstrates closing a connection.

[Visual Basic] 

' 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#] 

// 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");}     
                

Requirements

Namespace: Dart.PowerTCP.Ftp

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Assembly: Dart.PowerTCP.Ftp (in Dart.PowerTCP.Ftp.dll)

See Also

Response Members  | Dart.PowerTCP.Ftp Namespace

 

Send comments on this topic.

Documentation version 3.0.3.0.

© 2008 Dart Communications.  All rights reserved.