EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP client upload and SSH_FILEXFER_ATTR_SIZE

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#28933
Posted: 03/24/2014 15:06:31
by Ronald Peters (Standard support level)
Joined: 02/21/2014
Posts: 9

We are transferring files over SFTP to a server that performs better if the size of the file is transmitted. Is there a way to get TElSimpleSFTPClient.UploadStream to communicate the file size via the size field of the file attributes?

http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#page-13

SBB 11.0.245

Regards,
Ron
#28934
Posted: 03/24/2014 15:11:09
by Eugene Mayevski (EldoS Corp.)

Frankly speaking, I don't understand how this should work. SFTP is not FTP, it doesn't have ALLO command as it's not a file transfer protocol (despite its name) but remote filesystem access protocol.

Maybe you mean setting file size, then opening it in "overwrite" mode and writing the data. This is what you can do now, but you will need to use lower-level methods (OpenFile, WriteFile, CloseHandle) which will be slower than the method we use for uploading.


Sincerely yours
Eugene Mayevski
#28935
Posted: 03/24/2014 15:21:07
by Ronald Peters (Standard support level)
Joined: 02/21/2014
Posts: 9

I'm not as familiar with SFTP as with other protocols, but I think I understand what you're saying. In OpenFile, how would I encode the size itself? I see the attributes flags, but not the attributes themselves. Or is this something that is handled for me if I use Open->Write->Close();

I know it's less efficient, but it's better for this particular target server.

Regards,
Ron
#28936
Posted: 03/24/2014 15:24:31
by Ronald Peters (Standard support level)
Joined: 02/21/2014
Posts: 9

Nevermind, I answered my own question. They are not flags, but is a complex objects where I can set the size. I will try this method and will come back to this thread with my resolution.

Thanks,
Ron
#28937
Posted: 03/24/2014 15:27:36
by Eugene Mayevski (EldoS Corp.)

The idea is that you create a file (using CreateFile method), then set its size by either using SetAttributes or by calling WriteFile and writing one byte to the tail of the file, then you rewrite the data using WriteFile (starting with file offset 0).


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

Reply

Statistics

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