Version: 3.2.5.0
Construct high quality server and custom server proxy applications using FTP, DNS, and TCP protocols.

FtpServer ActiveX Control

The FtpServer control is used to build custom FTP server applications. Features include:

  • The FtpServer control uses an internal Daemon object and dynamically creates internal TCP objects as each passive connection is automatically accepted. Use this TCP object to send and receive data to that individual connection.
  • When a request is received, a corresponding event is raised. Write your own custom handling code in the event handler.
  • Add authentication and customized user directories within the Login event.
  • Disallow changing directories within the ChangeDirectoryUp and ChangeWorkingDirectory events to those who do not have proper permissions.
  • Disallow directory creation/deletion within the MakeDirectory and RemoveDirectory methods to those who do not have proper permissions
  • Disallow file upload/download within the Retrieve and Store event to those who do not have proper permissions.

 

Development Environments

  • Visual Studio .NET (.NET Framework)
  • Visual Basic (VB)
  • Visual C++ (VC++)
  • FoxPro
  • ASP
  • Office 97/2000

 

Interface

 

Public Properties
Count Number of nonsecure TCP connections currently open.
EndEvent Regulates whether the events will be raised only at the beginning of an operation, or both at the beginning and the end of an operation.
LocalAddress Returns the address in use while the Daemon is active and an empty string when the Daemon socket is closed.
LocalPort Returns the port number in use while the Daemon is active and 0 when the Daemon is closed.
LogDirectory Directory for daily log files.
MaxIdleTime Maximum time in minutes a session can be idle before it terminates.
QuitMessage Message sent to the client in response to a QUIT command (when the user logs out).
RequestAccountInfo Controls whether the ACCT command is requested.
RestartAllowed Indicates whether users can restart file transfers.
Sessions Collection of active Session Objects.
Status Text description of the server status. This is the message returned to the client in response to a STAT command.
SystemName System name and type. This is the message returned to the client in response to a SYST command.
WelcomeMessage Message returned to the client when the client initially connects.
Public Methods
About Show the About Box.
Pause Stop the server from listening and accepting new connections, while allowing established connections and sessions to persist.
Start Start processing FTP requests.
Stop Stop the server from accepting new connections and immediately close existing client connections.
Public Events
Append Fires when the client attempts to append to a file (by sending an APPE command).
ChangeDirectoryUp Fires when the client sends a CDUP command.
ChangeWorkingDirectory Fires when the client sends a CWD command.
Command Fires when the client sends a custom command.
Delete Fires when the client sends a DELE command.
Error Fires whenever an error condition occurs.
Help Fires when the client sends the HELP command.
List Fires when the client sends a LIST command.
Login Fires when the client attempts to log into the server.
Logout Fires when the client sends the QUIT command.
MakeDirectory Fires when the client sends a MKD command.
NameList Fires when the client sends a NLST command.
RemoveDirectory Fires when the client sends a RMD command.
Rename Fires when the client attempts to rename a file.
Retrieve Fires when the client attempts to retrieve a file.
SessionEnd Fires just before the session is terminated.
SessionInit Fires when the client first connects to the server.
Site Fires when the client sends the SITE command.
Status Fires when the client sends the STAT command.
Store Fires when the client attempts to store a file.
StructureMount Fires when the client sends the SMNT command.

Code Example

How easy is the FtpServer ActiveX control to use? Check out the VB examples below, which demonstrates creating a fully-functional FTP Server application which performes user authentication.

Private Sub StartServer()
    ' Start the server listening on port 21 with the FTP root C:\FtpRoot
   FtpServer1.Start "C:\FtpRoot"
End Sub

Private Sub FtpServer1_Login(ByVal Request As DartFtpServerCtl.IRequest, 
ByVal Response As DartFtpServerCtl.IResponse)
   ' Perform your own username and password validation here. Currently
   ' for now simply hardcode to only allow username "joe" and password "schmoe".
   If Request.Session.User.Name = "joe" And Request.Session.User.Password = "schmoe" Then
      ' Take no action. Let them log in.
   Else
      ' Reject the login. This will cause a "530 Login incorrect" response.
       Request.Session.User = Nothing
   End If
End Sub