Esempio n. 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();
        }
Esempio n. 2
0
        //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)
        {
        }
Esempio n. 3
0
        //Prints the name of the current working directory on return.

        public PwdCommandHandler(FTPCommandHandler ftpCommandHandler)
            : base("PWD", ftpCommandHandler)
        {
        }
Esempio n. 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)
        {
        }
Esempio n. 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)
        {
        }
Esempio n. 6
0
 public PasvCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("PASV", ftpCommandHandler)
 {
 }
Esempio n. 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)
        {
        }
Esempio n. 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)
        {
        }
Esempio n. 9
0
 public GetRootDirCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("GETROOTDIR", ftpCommandHandler)
 {
 }
Esempio n. 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)
        {
        }
Esempio n. 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)
        {
        }
Esempio n. 12
0
 public CwdCommandHandler(FTPCommandHandler ftpCommandHandler)
     : base("CWD", ftpCommandHandler)
 {
 }
Esempio n. 13
0
        //This command terminates the connection

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