I'm having an NSData object of approximately 50MB large. Now I want to transfer this via udpSocket.but 2kb up data not send....how to convert this nsdata small file or data approximately 2kb.
I'm use this code to send nsdata:
- (IBAction)send:(id)sender
{
NSString *host = addrField.text;
if ([host length] == 0)
{
[self logError:@"Address required"];
return;
}
int port = [portField.text intValue];
if (port <= 0 || port > 65535)
{
[self logError:@"Valid port required"];
return;
}
NSString *msg = [[NSBundle mainBundle] pathForResource:@"veer" ofType:@"mp3"];
if ([msg length] == 0)
{
[self logError:@"Message required"];
return;
}
NSData* data =[[NSData alloc]init];
data= [NSData dataWithContentsOfFile:msg];
[udpSocket sendData:data toHost:host port:port withTimeout:-1 tag:tag];
NSLog(@"%ld",tag);
[self logMessage:FORMAT(@"SENT (%i): %@", (int)tag, msg)];
udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
//omitted error checking
[udpSocket bindToPort:port error:nil];
[udpSocket joinMulticastGroup:host error:nil];
[udpSocket beginReceiving:nil];
tag++;
}
send only 2200 byte size not nsdata.2200 byte up(large)data not send please give any solution.