Re: Stream problem (General questions)
Hi,
What kind of database are you trying to use with wodFtpDLX.NET component for downloading and uploading files?
Regards,
Drazen
The back end is SQL Server, but I think it's unrelated to the problem. The helper function above needs to take a string, convert it to a stream, and upload it as a file to the server, and then it also needs to be able to download a file into a stream, and convert it to a string.
The upload part works great, but the download is where the issue is.
Basically, the problem I'm having is that the GetFile(stream, remotePath) function is not leaving the stream open, so my only option is to save the file to the local drive, import it and save it to the database, and then delete it. The file contains batches of credit card payments going to a 3rd party for authorization and it's a security risk to save it to the drive.
There is a similar problem posted here with your wodSFTP.Net component:
http://www.weonlydo.com/index.asp?forum=1&action=view&topic=1123526776#1123526776
When I try to reproduce that using FtpDLX (as follows), it does not work:
[code]
static void Main(string[] args) {
WeOnlyDo.Client.FtpDLX s = new FtpDLX();
s.Protocol = Protocols.SFTP;
s.Blocking = true;
s.Hostname = xxx.xxx.com ;
s.Login = login ;
s.Password = password ;
s.Connect();
Stream NewMsgStream = new MemoryStream();
//Stream is readable
s.LocalPath = c:000004.csv ;
s.GetFile(NewMsgStream, /out/0000004.csv );
//Stream is closed here, next line throws exception!!
NewMsgStream.Position = 0;
byte[] b = new Byte[20];
NewMsgStream.Read(b, 0, 20);
s.Disconnect();
}
[/code]
EDIT: This problem is only happening on a SFTP server. If I use the EXACT same code above (except changing the protocol to Protocols.FTP ), and connect to a standard FTP server instead, it works fine.
Complete thread:
- Stream problem - TheChad2k6, 2006-05-15, 22:56
- Re: Stream problem - TheChad2k6, 2006-05-15, 22:58
- Re: Stream problem - wodDrazen, 2006-05-16, 09:33
- Re: Stream problem - TheChad2k6, 2006-05-16, 15:10
- Re: Stream problem - wodSupport, 2006-05-16, 16:55
- Re: Stream problem - TheChad2k6, 2006-05-16, 15:10
- Re: Stream problem - wodDrazen, 2006-05-16, 09:33
- Re: Stream problem - TheChad2k6, 2006-05-15, 22:58