EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get Target Stream to Perform FTP Upload

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#29703
Posted: 06/05/2014 20:53:11
by Sean Taylor (Priority Standard support level)
Joined: 12/18/2013
Posts: 11

I have a blob in Azure Blob Storage and want to stream the contents to an FTP endpoint. I have the blob and have the client connection using TElSimpleFTPSClient. How can I get the target stream so that I may pass it to the DownloadToStream method of my blob?

This is the current code that I am using .net's FtpWebRequest object. I need to change it to use TElSimpleFTPSClient.


Code
var ftpRequest = _ftpService.GetWebRequest(blobToFtpEntity.OutboundFtp.GetFtpUri(blobToFtpEntity.OutboundFtp.FtpOutputFileName),
                blobToFtpEntity.OutboundFtp.FtpUsername,
                blobToFtpEntity.OutboundFtp.FtpPassword, TimeSpan.FromMinutes(1));

                ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;

                blob.DownloadToStream(ftpRequest.GetRequestStream());
#29705
Posted: 06/06/2014 01:24:39
by Eugene Mayevski (EldoS Corp.)

TElSimpleFTPSClient works differently. You have the source stream and pass it to TElSimpleFTPSClient . So you need to create a BLOB stream in some way (depending on what you use to access Azure), then pass that BLOB stream to TElSimpleFTPSClient.UploadStream() method.

There's no way to send or receive something to/from TElSimpleFTPSClient via streams because Stream object was designed not as a pipe but as a data source/target (much like files in Windows are data containers, not pipes like in Unix).


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 376 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!