Click here to Skip to main content
15,881,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Objective-C
GCDAsyncUdpSocket *sendSocket;
sendSocket = [[GCDAsycUdpSocket alloc] initwithDelegate:self delegateQueue:dispatch_get_main_queue()];
for(int i = 0;i < sort.count; i++)
{ 
   [sendSocket sendData:[sort objectAtIndex:i toHost:@"239.1.1.110" port:46110 Timeout:-1 tag:1];
}


Objective-C
GCDAsyncUdpSocket *sendSocket;
sendSocket = [[GCDAsycUdpSocket alloc] initwithDelegate:self delegateQueue:dispatch_get_main_queue()];
for(int i = 0;i < sort.count; i++)
{ 
   [sendSocket sendData:[sort objectAtIndex:i toHost:@"239.1.1.110" port:46110 Timeout:-1 tag:1];
   [Thread sleepForTimeInterval:0.003f];
}


What I have tried:

I use GCDAsyncSocket to send images in my application.The images are big,so I split its data to many small packets which save in a NSMutablearray called sort.When I use the first block of code,nothing is sent.
Then I add a line of code as second block of code,it worked.However my application is weird.
The point is I want to know the right or better way to send a list of data by GCDAsyncUdpSocket. Any help is appreciated,thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900