EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Stream access via OpenStream

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 05/14/2012 10:01:24
by Nauman Malik (Basic support level)
Joined: 05/14/2012
Posts: 4

I am trying to get file stream using sftpClient.OpenStream but I am not sure about the sequence of events that should follow it. Also what is 'int Modes' for 2nd parameter. Can I have a sample code for it?

Any help much appreciated :)
Posted: 05/15/2012 05:31:21
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

You can find a description of Modes parameter here: http://www.eldos.com/documentation/sb...nfile.html
Posted: 05/29/2012 14:01:24
by Nauman Malik (Basic support level)
Joined: 05/14/2012
Posts: 4

I am using this for Mode

128 fmOpenOrCreate If the file exists, it will be opened. If the file does not exist, it will be created.

SftpClient.OpenStream(remoteFileName, 128);

But its throwing an exception 'File not found'. Am I missing something ?

First I thought its a license issue , but I just bought one and its still giving me this error.

Any help will be much appreciated. Thanks.
Posted: 05/30/2012 04:23:25
by Vsevolod Ievgiienko (EldoS Corp.)

Possibly its a buggy server. Try to open a file using OpenFile method with Attributes parameter set to 'null'.
Posted: 05/30/2012 15:14:08
by Nauman Malik (Basic support level)
Joined: 05/14/2012
Posts: 4

I am trying to get a file stream using 'OpenStream' method. I want it to create a file if file is not already there and return me a stream to that file.

The server is not buggy but it just have restrictive environment. Once a file handle is lost then you can't add more data to file.

Right now I am using

Stream myStream = sftpClient.OpenStream('123.txt', 2);

but this is not what I want. I want this

Stream myStream = sftpClient.OpenStream('123.txt', 2);

to create a file and also return the stream for writing.

thanks for the help.
Posted: 05/30/2012 16:11:27
by Eugene Mayevski (EldoS Corp.)

I have no idea what "2" for Modes is - Mode is a combination of specific flags, eg. "SBSftpCommon.fmCreate | SBSftpCommon.fmWrite | SBSftpCommon.fmTruncate" (this particular combination is used by TElSFTPClient.CreateFile() method). Depending on the server the combination of flags can be different because different servers treat the same flag differently (either due to misreading specification or due to vague descriptions in specification).

Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.



Topic viewed 1835 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!