BlackRaccoon and WhiteRaccon server timeout error

I am using White Raccoon and Black Raccoon both to upload a zip file to an FTP server. In White Raccoon I was unable to download the zip file, I always get the serverTimeout error. So I tried to load a regular xml file with white raccoon, the file is loaded without any data (size 0 bytes). Here is the code

-(void)upload:(NSData*)data{

//the upload request needs the input data to be NSData
NSData * ourImageData = data;

//we create the upload request
//we don't autorelease the object so that it will be around when the callback gets called
//this is not a good practice, in real life development you should use a retain property to store a reference to the request
WRRequestUpload * uploadImage = [[WRRequestUpload alloc] init];
uploadImage.delegate = self;

//for anonymous login just leave the username and password nil
uploadImage.hostname = @"hostname";
uploadImage.username = @"username";
uploadImage.password = @"password";

//we set our data
uploadImage.sentData = ourImageData;

//the path needs to be absolute to the FTP root folder.
//full URL would be ftp://xxx.xxx.xxx.xxx/space.jpg
uploadImage.path = @"huge_test.zip";

//we start the request
[uploadImage start];
}

      

I am using this https://github.com/valentinradu/WhiteRaccoon

-As WhiteRaccoon doesn't work for me, I tried BlackRaccoon, but it doesn't help me even load a regular xml file, it just gives me a "Stream with error from server" error.

here is the code

- (IBAction) uploadFile :(NSData *)datas{

self.uploadData = [NSData dataWithData:datas];

 //Here I am just Checking that DATA come from another method is proper or not. I got All thedata which I have passed from method
    NSString  *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test12121.xml"];
    // Write the data to file
[datas writeToFile:path atomically:YES];
    self.uploadFile = [[BRRequestUpload alloc] initWithDelegate: self];

//----- for anonymous login just leave the username and password nil
self.uploadFile.path = @"/test.xml";
self.uploadFile.hostname = @"hostname";
self.uploadFile.username = @"username";
self.uploadFile.password = @"password";
//we start the request
[self.uploadFile start];

}

- (long) requestDataSendSize: (BRRequestUpload *) request{

 //----- user returns the total size of data to send. Used ONLY for percentComplete
 return [self.uploadData length];

}

 - (NSData *) requestDataToSend: (BRRequestUpload *) request{

 //----- returns data object or nil when complete
 //----- basically, first time we return the pointer to the NSData.
 //----- and BR will upload the data.
 //----- Second time we return nil which means no more data to send
 NSData *temp = self.uploadData;   // this is a shallow copy of the pointer

 self.uploadData = nil;            // next time around, return nil...

 return temp;

 }

  -(void) requestFailed:(BRRequest *) request{

  if (request == uploadFile)
  {
    NSLog(@"%@", request.error.message);

    uploadFile = nil;
 }
   NSLog(@"%@", request.error.message);
  }

  -(BOOL) shouldOverwriteFileWithRequest: (BRRequest *) request
   {
  //----- set this as appropriate if you want the file to be overwritten
  if (request == uploadFile)
  {
    //----- if uploading a file, we set it to YES
    return YES;
  }

   //----- anything else (directories, etc) we set to NO
   return NO;
  }

  - (void) percentCompleted: (BRRequest *) request
    {
   NSLog(@"%f completed...", request.percentCompleted);
  }

  -(void) requestCompleted: (BRRequest *) request
  {
  //----- handle Create Directory
  if (request == uploadFile)
  {
    NSLog(@"%@ completed!", request);
    uploadFile = nil;
 }

 }

      

I am using https://github.com/lloydsargent/BlackRaccoon .

I even changed the timeout limit to 60 but it doesn't work for me. Can anyone help me? Anyone knows how to upload a zip file to an FTP server and then please let me know.

Thanks in advance.

+3


source to share





All Articles