从网络上下载大文件(视频)
2015-06-11 11:35
465 查看
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ self.receivedData = [[NSMutableData alloc]init]; }
View Code
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ [self.receivedData appendData:data]; NSLog(@"接受到服务器端来的数据%d",data.length); NSString *Data =[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@",Data); }
- (void)connectionDidFinishLoading:(NSURLConnection *)connection{ NSLog(@"222"); NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/a.mp4"]; NSLog(@"string = %@",path); [self.receivedData writeToFile:path atomically:YES]; }
相关文章推荐
- 阻塞read/write型socket网络连接弊端——缓冲区堆积——linux网络编程学习
- HTTP状态码大全
- 神经网络-神文
- 检查HTTP 的 Basic认证代码示例-JSP
- HttpClient详解与实例介绍(post方式与get方式)
- HttpClient使用详解
- httpurlconnection get String
- Andorid--Apache HttpClient(二)
- TCP之深入浅出send和recv
- TCP/IP详解_网际协议IP(一)_相关知识
- android-async-http框架之与网络进行数据交互
- 网络监控汇总(netstat)
- android开发网络资源
- 83款 网络爬虫开源软件
- http://www.cnblogs.com/xwdreamer/archive/2012/04/17/2454631.html
- WEB服务器、应用程序服务器、HTTP服务器区别[转]
- 先UDP组播 socket 再TCP建立长连接
- Android基础_判断WIFI移动网络状态,打开WIFI和移动网路
- OpenCV进阶之路:神经网络识别车牌字符
- ASIHTTPRequest开源类项目导入问题及解决方法