/// <summary> /// Build an <see cref="IFtpClient"/> and connect to the source FTP server. /// </summary> /// <param name="peerToConnectTo">The <see cref="FtpPeer"/> to create an FTP client for.</param> /// <returns>An awaitable object for the Connect operation.</returns> public async Task<IFtpClient> ConnectAsync(FtpPeer peerToConnectTo) { var ftpClient = new FtpMessageSender(new FTPSClient()); await ftpClient.ConnectAsync(peerToConnectTo); return ftpClient; }
/// <summary> /// Build an <see cref="IFtpClient"/> and connect to the source FTP server. /// </summary> /// <param name="peerToConnectTo">The <see cref="FtpPeer"/> to create an FTP client for.</param> /// <returns>An awaitable object for the Connect operation.</returns> public async Task <IFtpClient> ConnectAsync(FtpPeer peerToConnectTo) { var ftpClient = new FtpMessageSender(new FTPSClient()); await ftpClient.ConnectAsync(peerToConnectTo); return(ftpClient); }
/// <summary> /// Connect to the FTP server. /// </summary> /// <param name="peerToConnectTo">The address and credentials of the FTP server.</param> /// <returns>An awaitable object for the Connect operation.</returns> public async Task ConnectAsync(FtpPeer peerToConnectTo) { await Task.Factory.StartNew(() => this._ftpClient.Connect( peerToConnectTo.PeerAddress.Host, peerToConnectTo.PeerAddress.Port, peerToConnectTo.Credentials, ESSLSupportMode.ClearText, null, null, 0, 0, 0, Timeout.Infinite)); }