Exemple #1
0
        //public TcpClient theSocket = null;


        public ServerControl(ServerForm serverForm)
        {
            // TODO: Complete member initialization
            this.serverForm       = serverForm;
            this.CurrentDirectory = "";
            this.RootDirectory    = "";
            ftpCommandHandler     = new FTPCommandHandler(this);
            users = new Hashtable();
            foreach (string userName in serverForm.listBoxUsers.Items)
            {
                users[userName.ToUpper()] = serverForm.textBoxPassword;
            }
            Thread litenerThread = new Thread(new ThreadStart(ListenerSession));

            litenerThread.Start();
        }
        //This command comes immediately after the user command and completes the login and sets the access control privileges.

        public PasswordCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("PASS", ftpCommandHandler)
        {
        }
Exemple #3
0
        //Prints the name of the current working directory on return.

        public PwdCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("PWD", ftpCommandHandler)
        {
        }
Exemple #4
0
        //This command requests that the server transfers a copy of the file specified.
        //This transfer is to be done an the data port provided by the connection.
        //The status and contents of the file at the server remains unchanged.


        public RetrCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("RETR", ftpCommandHandler)
        {
        }
Exemple #5
0
        //Causes a list of files in the specified path to be transferred to the user.
        //If the pathname specified is a file then current information on that file will be sent.
        //If no path is specified the contents of the user's current working or default directory will be used.
        //This List is in a readable form and provides a list of files and their attributes.

        public ListCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("LIST", ftpCommandHandler)
        {
        }
Exemple #6
0
 public PasvCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("PASV", ftpCommandHandler)
 {
 }
Exemple #7
0
        //The USER command is required by the server for access to its file system.
        //This command will normally be the first command sent after the connection is made.
        //This has the effect of purging any user, password, and account information already
        //supplied at the beginning of the login sequence.

        public UserCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("USER", ftpCommandHandler)
        {
        }
Exemple #8
0
        //This command causes the server to accept data transferred via the data
        //connection and to store that data as a file at the server site.
        //If the file specified exists already on the server in the requested path, then the file shall be overwritten.
        //A new file is created on the server if the file specified does not already exist.

        public StoreCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("STOR", ftpCommandHandler)
        {
        }
 public GetRootDirCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("GETROOTDIR", ftpCommandHandler)
 {
 }
Exemple #10
0
        //This command causes the file specified to be deleted on the server.
        //An extra level of protection (such as the query, "Do you really wish to delete?")
        //can be provided by many of the existing FTP clients.

        public DeleCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("DELE", ftpCommandHandler)
        {
        }
Exemple #11
0
        //This command causes the directory or subdirectory specified to be removed.
        //Typically only empty directories can be removed.
        //This command is usually preceded by a DELE (delete) command.

        public RemoveDirectoryCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("RMD", ftpCommandHandler)
        {
        }
Exemple #12
0
 public CwdCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("CWD", ftpCommandHandler)
 {
 }
Exemple #13
0
        //This command terminates the connection

        public QuitCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("QUIT", ftpCommandHandler)
        {
        }
Exemple #14
0
 protected FtpCommand(string sCommand, FTPCommandHandler ftpCommandHandler)
 {
     this.Command           = sCommand;
     this.ftpCommandHandler = ftpCommandHandler;
 }