コード例 #1
0
ファイル: Main.cs プロジェクト: nolith/internetpack
    public static void StartServer()
    {
      string lDiskFolder = Path.GetDirectoryName(typeof(CmdMain).Assembly.Location)+@"\FtpRoot";;

      fRootFolder = new VirtualFolder(null, "[ROOT]");
      fRootFolder.Add(new VirtualFolder(null, "virtual"));
      fRootFolder.Add(new DiscFolder(null, "drive-c", @"c:\"));
      fRootFolder.Add(new DiscFolder(null, "disc", lDiskFolder));
      fRootFolder.Add(new EmptyFile(null, "=== Welcome to the FTP ==="));

      fUserManager = new UserManager();
      ((UserManager)fUserManager).AddUser("test", "test");

      fFtpServer = new VirtualFtpServer();
      fFtpServer.Port = 2222;
      fFtpServer.Timeout = 60*1000; /* 1 minute */
      fFtpServer.Binding.ListenerThreadCount = 10;
      fFtpServer.RootFolder = fRootFolder;
      fFtpServer.UserManager = fUserManager;
      fFtpServer.ServerName = "VirtualFTP Sample - powered by RemObjects Internet Pack for .NET";
      
      fFtpServer.Open();		

      Debug.Write("VirtualFTP 0.3 BETA - started up");
    }
コード例 #2
0
ファイル: FtpServer.cs プロジェクト: Fedorm/core-master
        public void Start()
        {
            rootFolder = new VirtualFolder(null, "root");
            SetReadOnly(rootFolder, "root");

            VirtualFtpServer fFtpServer = new VirtualFtpServer();
            fFtpServer.Detailed500Errors = true;
            fFtpServer.Port = port;
            fFtpServer.PassiveAddress = passiveAddress;
            fFtpServer.PassivePortFrom = passivePortFrom;
            fFtpServer.PassivePortTo = passivePortTo;
            fFtpServer.Timeout = 60 * 1000; /* 1 minute */
            if (fFtpServer.BindingV4 != null)
                fFtpServer.BindingV4.ListenerThreadCount = 10;
            fFtpServer.RootFolder = rootFolder;
            fFtpServer.UserManager = new UserManagerEx(fFtpServer, rootPath);
            fFtpServer.ServerName = "BitMobile FTP Server";
            fFtpServer.OnUserLogin += OnUserLogin;
            fFtpServer.OnChangeDirectory += OnChangeDirectory;

            fFtpServer.Open();
        }