Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kimti

macrumors newbie
Original poster
Feb 22, 2011
10
0
dear all:
I use AsyncUdpSocket for my iphone project:
Code:
  AsyncUdpSocket *udpSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];
  [udpSocket enableBroadcast:YES error:nil];
  [udpSocket bindToPort:6000 error:nil];
  [udpSocket receiveWithTimeout:-1 tag:0];
and in implement follow method:
Code:
- (void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag{
  NSLog(@"----------: 1");
}

- (void)onUdpSocket:(AsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error{
  NSLog(@"----------: 2");
}

- (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port{
  NSLog(@"----------: 3");
}

- (void)onUdpSocket:(AsyncUdpSocket *)sock didNotReceiveDataWithTag:(long)tag dueToError:(NSError *)error{
  NSLog(@"----------: 4");
}

- (void)onUdpSocketDidClose:(AsyncUdpSocket *)sock{
  NSLog(@"----------: 5");
}
why don't run to NSLog(@"----------: 3") when the server broadcast message to 192.168.16.255.

thank you.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.