私はcocoaAsyncSocketを使用することに決めました。
[udpSocket sendData:datatosend toHost:@"192.168.1.113" port:port withTimeout:-1 tag:0];
を受け取るために:
- (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)filterContext
{
NSString *msg = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
NSString *host = nil;
uint16_t port = 0;
[GCDAsyncUdpSocket getHost:&host port:&port fromAddress:address];
if (msg)
{
NSLog(@"Message = %@, Adress = %@ %i",msg,host,port);
}
else
{
NSLog(@"Error converting received data into UTF-8 String");
}
}
あなたが使用できるブロードキャストに