Sftp_PutFile resultant file size is 32768 instead - WeOnlyDo Discussion board

Sftp_PutFile resultant file size is 32768 instead (General questions)

by Art, Thursday, September 27, 2007, 23:52 (6270 days ago)

I built my application with your demo DLL this morning. Got it all working. Then I purchased the real library and now when I SFTP a small 1016 byte text file, the resultant file is 32768 bytes of junk.

Any clues?

I am using blocking mode:

Here is the basic code:

bool SFTPPutFile(CWnd* pParentWnd, const char* pszFileFullPath, const char* pszLogin, const char* pszPassword, const char* pszDirectory, CString& strError)
{
UsiEnableDisable enableDisable(pParentWnd); // disables window input for scope because the SFTP library looks like it is doing a peek message loop

bool b = false;
strError.Empty();

// the original method of doing the SFTP supported username@hostname as the login
// but the WeOnlyDo SFTP library needs them seperated
CString strPassword = pszPassword;
CString strLogin = pszLogin; // username@hostname
CString strUsername, strHostname;
strUsername = strLogin.Left(strLogin.Find( @ ));
strHostname = strLogin.Mid(1 + strLogin.Find( @ ));

void* handle = Sftp_Create(NULL, NULL);
Sftp_SetBlocking(handle, 1);
Sftp_SetHostname(handle, strHostname.GetBuffer(strHostname.GetLength() + 1));
strHostname.ReleaseBuffer();
Sftp_SetLogin(handle, strUsername.GetBuffer(strUsername.GetLength() + 1));
strUsername.ReleaseBuffer();
Sftp_SetPassword(handle, strPassword.GetBuffer(strPassword.GetLength() + 1));
strPassword.ReleaseBuffer();
Sftp_SetPort(handle, 22);

int nConnect = Sftp_Connect(handle);
GetSFTPPutFileError(handle, nConnect, pszFileFullPath, pszLogin, pszDirectory, strError);
if (0 == nConnect)
{
CString strLocalFileFullPath = pszFileFullPath;
CString strRemote = pszDirectory;
strRemote += / ;
strRemote += strLocalFileFullPath.Mid(1 + strLocalFileFullPath.ReverseFind('\'));
int nPutFile = Sftp_PutFile(handle,
strLocalFileFullPath.GetBuffer(strLocalFileFullPath.GetLength() + 1),
strRemote.GetBuffer(strRemote.GetLength() + 1));
strLocalFileFullPath.ReleaseBuffer();
strRemote.ReleaseBuffer();

GetSFTPPutFileError(handle, nPutFile, pszFileFullPath, pszLogin, pszDirectory, strError);

if (0 == nPutFile)
b = true;

Sftp_Disconnect(handle);
}

Sftp_Destroy(handle);
handle = NULL;

return b;
}

Re: Sftp_PutFile resultant file size is 32768 inst

by wodSupport, Friday, September 28, 2007, 00:08 (6270 days ago) @ Art

Art,

I sincerely apologize. Somehow in those few days we were making fixes and one of in development and in tests version ended up in CVS - and went online. Sorry about that!

Please request update at http://www.weonlydo.com/index.asp?update=1 and download it again, now it should work ok!

Kreso

Re: Sftp_PutFile resultant file size is 32768 inst

by Art, Friday, September 28, 2007, 00:14 (6270 days ago) @ wodSupport

Thanks.

How can I can change the email address used for updates?

A person in our finance department made the purchase but I am the one that needs access.

Re: Sftp_PutFile resultant file size is 32768 inst

by wodSupport, Friday, September 28, 2007, 00:18 (6270 days ago) @ Art

Arthur,

done. I see one you used to request update, and I have put it into the database.

Regards,
Kreso

Re: Sftp_PutFile resultant file size is 32768 inst

by Art, Friday, September 28, 2007, 00:52 (6270 days ago) @ wodSupport

Your update worked.

Thanks for the great responsiveness!