public MainForm() { InitializeComponent(); m_portConfigFile_default = new PortConfigFile(); SetConnectStateDisplay(); m_spPort.ReceivedDataHandle = m_atc.ReceivedFunc; string ftpHomeDir; ftpHomeDir = System.Windows.Forms.Application.StartupPath + "\\configfile"; DirectoryInfo dir = new DirectoryInfo(ftpHomeDir); dir.Create(); #if Telnet_Enable /* * 服务器的最大连接数 */ m_ftpServer.Capacity = 1000; /* * 连接超时时间 */ m_ftpServer.HeartBeatPeriod = 120000; //120秒 /* * 创建一个使用FTP的用户, */ FtpUser user = new FtpUser("ftp"); user.Password = "******"; user.AllowWrite = true; //dir.Create(); user.HomeDir = ftpHomeDir; /* * 限制该帐号的用户的连接服务器的最大连接数 * 也就是限制该使用该帐号的FTP同时连接服务器的数量。 */ user.MaxConnectionCount = 2; /* * 限制用户的最大上传文件为20M,超过这个值上传文件会失败。 * 默认不限制该值,可以传输大文件。 */ user.MaxUploadFileLength = 1024 * 1024 * 20; m_ftpServer.AddUser(user); //把当前目录作为匿名用户的目录,测试目的(必须指定) m_ftpServer.AnonymousUser.HomeDir = System.Windows.Forms.Application.StartupPath + "\\configfile"; #endif }