Beispiel #1
0
 private void StartServer()
 {
     if (this.txtServerIP.Text.Trim() == string.Empty || this.txtServerPort.Text.Trim() == string.Empty)
     {
         MessageBox.Show("FTP服务器IP或端口不能为空!");
         return;
     }
     if (this.txtServerRootDirectory.Text.Trim() == string.Empty)
     {
         MessageBox.Show("请选择服务器文件根目录!");
         return;
     }
     if (System.IO.Directory.Exists(this.txtServerRootDirectory.Text.Trim()) == false)
     {
         MessageBox.Show("填写的目录不存在!");
         return;
     }
     try
     {
         this._ftpServer = new FtpServer(this.txtServerIP.Text.Trim(), Convert.ToInt32(this.txtServerPort.Text.Trim()), this.txtServerRootDirectory.Text.Trim());
         this._ftpServer.Start();
         EnableWhenStartServer();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            FtpServer server = new FtpServer();

            server.Start();
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            FtpServer server = new FtpServer();

            server.Start();

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            FtpServer server = new FtpServer();

            server.Start();
            Console.WriteLine("Server started");
            string text = Console.ReadLine();

            while (text != "exit")
            {
                text = Console.ReadLine();
            }
            server.Stop();
            Console.WriteLine("Server stopped");
            Console.ReadKey();
        }
Beispiel #5
0
 private void StopServer()
 {
     this._ftpServer.Stop();
     this._ftpServer = null;
     EnableWhenInit();
 }