Yes the OpenFile() should be null there as you say. I had the messageBoxes after each declaration and had actually 4 error messages the FIRST loop, then the second loop I did not get any error messages and the file was created fine.
It is little spooky, I have sent these to the support of those functions to see if I miss something. The code in their documenation is for C# so something might perheps dont be the same for C++.
As seen I have put 30 cycles in that loop now and I tried to upload the file 10 times now and it did succed 10/10 times, which is a good indication.
If it doesn´t succeed, a messageBox will tell to try in a few seconds again. Perheps I will be happy with this, what do you think ?
int succeded = 0;
String^ LongString = "testString";
for( int i = 0; i < 30; i++ ) //try 10 times
{
succeded = 0;
Thread::Sleep(5);
try
{
for( int aaa = 0; aaa < 1; aaa++ )//just for break
{
Chilkat::SFtp^ sftp = gcnew Chilkat::SFtp();
if( ! sftp->UnlockComponent("dummy") ){succeded = 1; break;}//Check if succeded
sftp->ConnectTimeoutMs = 5000;
sftp->IdleTimeoutMs = 15000;
long port = 2222;
String^ hostname = "dummy.host.com";
if( ! sftp->Connect(hostname, port) ){succeded = 1; break;}//Check if succeded
if( ! sftp->AuthenticatePw(tr1,tr2) ){succeded = 1; break;}//Check if succeded
if( ! sftp->InitializeSftp() ){succeded = 1; break;}//Check if succeded
String^ handle1;
handle1 = sftp->OpenFile("Folder1/Folder2/testFile.txt", "writeOnly", "createTruncate");
if( handle1 …