tags:

views:

199

answers:

1

I am using the simpleFTPsample of apple. I want to display a progress bar of the file being downloaded. I understand it needs to be done in:
- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
under the case:
case NSStreamEventOpenCompleted:

how do i retrive the file size from the NSInputStream?

I have also tried:

i have set:
[self.networkStream setProperty:@"YES" forKey:(id)kCFStreamPropertyFTPFetchResourceInfo];
and then:
NSLog(@"size: %@",[self.networkStream propertyForKey:(id)kCFStreamPropertyFTPResourceSize]);
but the result is null...

+1  A: 

You will have to set kCFStreamPropertyFTPFetchResourceInfo to true. That way the CFFTPStream will send a STAT command to the FTP server to get file info, including the total size.

St3fan
Thanks, but it is not working. i have change the question to include your answer. did i it wrong?
idober
Maybe instead of @"YES" you will need [NSNumber numberWithBool: YES]. Also, the server will have to support this. An way to debug this is to run tcpdump and look at what the CFStream is actually sending to the server.
St3fan