开发者

Does iPhone SDK limit udp broadcast?

AsyncUdpSocket *socket=[[AsyncUdpSocket alloc]initWithDelegate:self];

NSTimeInterval timeout=500;
NSString *request=@"quick_stat";
NSData *data=[NSData dataWithData:[request dataUsingEncoding:NSASCIIStringEncoding] ];
UInt16 port=8081;  
[socket sendData :data toHost:@"255.255.255.255" port:port withTimeout:timeout tag:1];
NSLog(@"begin scan");

if host address is "255.255.255.255", or "192.168.1.255", will get

2011-03-30 19:40:34.547 voco[38177:207] AsyncUdpSocket 0x629bf30 received unexpected CFSocketCallBackType 8. 2011-03-30 19:40:34.549 voco[38177:207] Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied" UserInfo=0x62b4360 {NSLocalizedDescription=Permission denied} 2011-03-30 19:40:34.550 voco[38177:207] not send

If host address is "255.255.255.0" or "192.168.0.255" will get

begin scan

2011-03-30 19:35:48.415 voco[37930:207] AsyncUdpSocket 0x565fea0 received unexpected CFSocketCallBackType 8. 2011-03-30 19:35:48.417 voco[37930:207] se开发者_如何学Cnd

So I guess is not caused by my code. How can I fix it?


Fixed by add [socket enableBroadcast:YES error:error];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜