我的项目:通过WIFI连接,SOCKET传输。当我收到图片数据时,错误信息:<code>ImageIO: <ERROR> JPEGNot a JPEG file: starts with 0xff 0xd9。</code>
-(void)decodeData:(char*)data length:(int)length {
struct TVDATA *tvData=(struct TVDATA *)data;
[jpgData appendBytes:(char*)tvData+8 length:length-8];
if(tvData->m_frag_totle-1==tvData->m_frag_cur) {
image = [[UIImage alloc] initWithData:jpgData];
[self performSelectorOnMainThread:@selector(aa) withObject:nil waitUntilDone:!NO];
jpgData.length=0;
}
-(void)aa {
if(imgView.image!=nil){
[imgView.image release];
}
imgView.image=image;
[scrollView setDisplayImage:image];
if (videoflag==1) {
[self performSelectorOnMainThread:@selector(writeVideo) withObject:nil waitUntilDone:!NO];
}
}