Ejemplo n.º 1
0
        private async Task OpenDataConnectionAsync()
        {
            if (dataConnection != null && dataConnection.IsOpen)
            {
                await ReplyAsync(FtpReplyCode.TransferStarting, "Transfer is starting");
            }
            else
            {
                await ReplyAsync(FtpReplyCode.AboutToOpenDataConnection, "File is Ok, about to open connection.");

                switch (dataConnectionMode)
                {
                case DataConnectionMode.Active:
                case DataConnectionMode.ExtendedActive:
                    await dataConnection.ConnectActiveAsync(userActiveIP, userActiveDataPort, userActiveProtocal);

                    break;

                case DataConnectionMode.Passive:
                case DataConnectionMode.ExtendedPassive:
                    await dataConnection.AcceptAsync();

                    break;
                }
            }
            if (useSecureDataConnection)
            {
                await(dataConnection as ISslDataConnection).UpgradeToSslAsync();
            }
        }