NSURLDownload and web sharing server
NSURLDownload and web sharing server
- Subject: NSURLDownload and web sharing server
- From: Elliott <email@hidden>
- Date: Thu, 14 Jan 2010 14:51:22 -0800 (PST)
When downloading a large file (~6 GB) either on 127.0.0.1 or another machine on the same subnet via web sharing, NSURLDownload seems to hang at some point in the middle of the download. This doesn't seem to happen when using other servers. Also Safari seems to be able to download the file just fine. The client is using 10.6.2. I've tried web sharing on the local machine (127.0.0.1 and 10.6.2) and also on a remote machine using 10.5.8. I've written a simple tool to test this that looks like:
- (void)downloadDidFinish: (NSURLDownload *)download
{
NSLog(@"downloadDidFinish");
// release the connection
[download release];
}
- (void)download: (NSURLDownload *)download didFailWithError: (NSError *)error
{
NSLog(@"download didFailWithError\n");
// release the connection
[download release];
// inform the user
NSLog(@"Download failed! Error - %@ %@",
[error localizedDescription],
[[error userInfo] objectForKey:NSErrorFailingURLStringKey]);
}
- (void)download: (NSURLDownload *)download didReceiveResponse: (NSURLResponse *)response
{
NSLog(@"download didReceiveResponse\n");
}
- (void)download: (NSURLDownload *)download didReceiveDataOfLength: (unsigned)length
{
NSLog(@"download didReceiveDataOfLength %lld\n", length);
}
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
MyHandler *theHandler = [[MyHandler alloc] init];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: (NSString *)@"http://10.147.27.137/~elliott/winxp.hdd"]
cachePolicy: NSURLRequestReloadIgnoringCacheData/*NSURLRequestUseProtocolCachePolicy*/
timeoutInterval: 60.0];
// create the connection with the request
// and start loading the data
NSURLDownload *theDownload = [[NSURLDownload alloc] initWithRequest: theRequest delegate: theHandler];
[theDownload setDestination: (NSString *)@"/Users/elliott/Documents/testdownloadfile" allowOverwrite: YES];
CFRunLoopRun();
[pool drain];
return 0;
}
At some point I stop getting download didReceiveDataOfLength and never get a downloadDidFinish nor didFailWithError. Am I doing something wrong?
Elliott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden