コード例 #1
0
        /// <summary>
        /// Creates a new passive mode data channel for the FTP session.
        /// </summary>
        /// <param name="arguments">Command arguments</param>
        /// <param name="session">FTP session context</param>
        /// <param name="cancellation">Cancellation token</param>
        /// <returns>FTP server response to send to the client.</returns>
        protected override Task <IResponse> Handle(string arguments, FtpSessionState session, CancellationToken cancellation)
        {
            var channel =
                new PassiveDataChannel(
                    new IPEndPoint(session.ServerAddress, 0),
                    new LoggerScope(TraceResources.PassiveModeLoggerScope, session.Logger));

            session.DataChannel = channel;

            return
                (FtpResponsesAsync.PassiveMode(
                     session.PublicServerAddress.GetAddressBytes(),
                     channel.EndPoint.Port));
        }
コード例 #2
0
 /// <summary>
 /// Generates the response with the list of supported server features.
 /// </summary>
 /// <param name="arguments">Command arguments</param>
 /// <param name="session">FTP session context</param>
 /// <param name="cancellation">Cancellation token</param>
 /// <returns>FTP server response to send to the client.</returns>
 protected override Task <IResponse> Handle(string arguments, FtpSessionState session, CancellationToken cancellation)
 {
     return(FtpResponsesAsync.Features(features, session.LineFeed));
 }
コード例 #3
0
 /// <summary>
 /// Creates a response that contains current working directory path.
 /// </summary>
 /// <param name="arguments">Command arguments</param>
 /// <param name="session">FTP session context</param>
 /// <param name="cancellation">Cancellation token</param>
 /// <returns>FTP server response to send to the client.</returns>
 protected override Task <IResponse> Handle(string arguments, FtpSessionState session, CancellationToken cancellation)
 {
     return(FtpResponsesAsync.Path(session.CurrentDirectory.ToString(), session.PathEncoding));
 }